From 28f6eff25ff3231291455ed7080df0b454087530 Mon Sep 17 00:00:00 2001 From: Benoit Lavenier <benoit.lavenier@e-is.pro> Date: Fri, 11 Aug 2023 19:41:41 +0200 Subject: [PATCH] fix(js): Fix JS compilation error --- www/js/controllers/feed-controllers.js | 8 ++-- www/js/controllers/home-controllers.js | 4 +- www/js/services/bma-services.js | 58 ++------------------------ www/js/services/tx-services.js | 6 +-- 4 files changed, 12 insertions(+), 64 deletions(-) diff --git a/www/js/controllers/feed-controllers.js b/www/js/controllers/feed-controllers.js index a7c9f0ff..f30d153e 100644 --- a/www/js/controllers/feed-controllers.js +++ b/www/js/controllers/feed-controllers.js @@ -170,7 +170,7 @@ function FeedController($scope, $timeout, $http, $translate, $q, csConfig, csHtt cache: csCache.get('csFeed-', csCache.constants.LONG) }) .success(resolve) - .error(reject) + .error(reject); }); }; @@ -188,7 +188,7 @@ function FeedController($scope, $timeout, $http, $translate, $q, csConfig, csHtt * @returns {{content}|*} */ $scope.prepareJsonFeedItem = function(item, feed) { - if ($scope.isEmptyFeedItem(item)) throw Error('Empty feed item') + if ($scope.isEmptyFeedItem(item)) throw Error('Empty feed item'); var maxContentLength = $scope.search.maxContentLength; @@ -303,7 +303,7 @@ function FeedController($scope, $timeout, $http, $translate, $q, csConfig, csHtt console.error("[feed] Failed to load discourse topic from '{}'".format(topicUrl), err); return null; // continue }) - ) + ); }, [])) .then(function(topics) { feed.items = topics.reduce(function(res, topic) { @@ -355,7 +355,7 @@ function FeedController($scope, $timeout, $http, $translate, $q, csConfig, csHtt name: post.display_username, url: [baseUrl, 'u', post.username].join('/'), avatar: post.avatar_template ? (baseUrl + post.avatar_template.replace('{size}', '60')) : undefined - } + }; // Try to resolve author pubkey, to replace author url by a link to wot identity var developer = _.find(csConfig.developers || [], function(developer) { diff --git a/www/js/controllers/home-controllers.js b/www/js/controllers/home-controllers.js index 981a87c2..cfdd6894 100644 --- a/www/js/controllers/home-controllers.js +++ b/www/js/controllers/home-controllers.js @@ -100,9 +100,9 @@ function HomeController($scope, $state, $timeout, $ionicHistory, $translate, $ht }; $scope.toggleFeed = function(show) { - $scope.showFeed = (show !== undefined) ? show : !$scope.showFeed + $scope.showFeed = (show !== undefined) ? show : !$scope.showFeed; $scope.$broadcast('$$rebind::feed'); // force rebind feed - } + }; /* -- show/hide locales popup -- */ diff --git a/www/js/services/bma-services.js b/www/js/services/bma-services.js index 6d768752..982a0565 100644 --- a/www/js/services/bma-services.js +++ b/www/js/services/bma-services.js @@ -932,7 +932,7 @@ angular.module('cesium.bma.services', ['ngApi', 'cesium.http.services', 'cesium. */ exports.blockchain.blocks = function(blockNumbers){ return $q.all(blockNumbers.map(function(block) { - return exports.blockchain.block({block: block}) + return exports.blockchain.block({block: block}); })); }; @@ -942,7 +942,7 @@ angular.module('cesium.bma.services', ['ngApi', 'cesium.http.services', 'cesium. */ exports.network.peering.peersByLeaves = function(leaves){ return $q.all(leaves.map(function(leaf) { - return exports.network.peering.peers({leaf: leaf}) + return exports.network.peering.peers({leaf: leaf}); })); }; @@ -952,7 +952,7 @@ angular.module('cesium.bma.services', ['ngApi', 'cesium.http.services', 'cesium. return $q(function(resolve, reject) { var result = []; var jobs = []; - var chunk = paramValues.slice(offset, offset+size) + var chunk = paramValues.slice(offset, offset+size); _.each(chunk, function(paramValue) { var requestParams = {}; requestParams[paramName] = paramValue; @@ -998,58 +998,6 @@ angular.module('cesium.bma.services', ['ngApi', 'cesium.http.services', 'cesium. }); }; - function retryableSlices(getRequestFns, slices, offset, size) { - offset = angular.isDefined(offset) ? offset : 0; - size = size || exports.constants.LIMIT_REQUEST_COUNT; - return $q(function(resolve, reject) { - var result = []; - var jobs = []; - var chunk = slices.slice(offset, offset+size) - _.each(chunk, function(params) { - jobs.push( - getRequestFns(params) - .then(function(res){ - if (!res) return; - result.push(res); - }) - ); - }); - - $q.all(jobs) - .then(function() { - if (offset < slices.length - 1) { - // Loop, with a new offset - $timeout(function() { - exports.raw.getHttpRecursive(getRequestFns, slices, offset+size, size) - .then(function(res) { - if (!res || !res.length) { - resolve(result); - return; - } - - resolve(result.concat(res)); - }) - .catch(function(err) { - reject(err); - }); - }, exports.constants.LIMIT_REQUEST_DELAY); - } - // End - else { - resolve(result); - } - }) - .catch(function(err){ - if (err && err.ucode === exports.errorCodes.HTTP_LIMITATION) { - resolve(result); - } - else { - reject(err); - } - }); - }); - }; - exports.blockchain.lastUd = function() { return exports.blockchain.stats.ud() .then(function(res) { diff --git a/www/js/services/tx-services.js b/www/js/services/tx-services.js index d98b85fd..b70c7b89 100644 --- a/www/js/services/tx-services.js +++ b/www/js/services/tx-services.js @@ -152,7 +152,7 @@ angular.module('cesium.tx.services', ['ngApi', 'cesium.bma.services', if (err && err.ucode === BMA.errorCodes.HTTP_LIMITATION && retryPendingCount < 3) { retryPendingCount++; return $timeout(function() { - return BMA.tx.history.pending({pubkey: pubkey}) + return BMA.tx.history.pending({pubkey: pubkey}); }, 2000 * retryPendingCount); } throw err; @@ -188,7 +188,7 @@ angular.module('cesium.tx.services', ['ngApi', 'cesium.bma.services', // get TX from a given time if (fromTime > 0) { jobs.push($q.all(slices.map(function(slice) { - return BMA.tx.history.times(slice.params, slice.cache).then(reduceTxFn) + return BMA.tx.history.times(slice.params, slice.cache).then(reduceTxFn); }))); } @@ -345,7 +345,7 @@ angular.module('cesium.tx.services', ['ngApi', 'cesium.bma.services', // Some input source not exist: mark as error if (!validInputs) { - console.error("[tx] Pending TX '{}' use an unknown source as input: mark as error".format(tx.hash)) + console.error("[tx] Pending TX '{}' use an unknown source as input: mark as error".format(tx.hash)); txErrors.push(tx); } -- GitLab