From 04cf2672c3a06dbaa7792403237e3ec9bbaf5455 Mon Sep 17 00:00:00 2001 From: Marco Nassabain Date: Sun, 7 Mar 2021 00:23:38 +0100 Subject: =?UTF-8?q?=F0=9F=8E=A8=20Adapt=20front-end=20to=20match=20new=20i?= =?UTF-8?q?mplementation=20-=20remove=20share-specific=20code=20since=20ne?= =?UTF-8?q?w=20solution=20uses=20dummy=20feeds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marco Nassabain --- js/app/Run.js | 9 +++------ js/controller/ContentController.js | 17 ++++------------- js/controller/NavigationController.js | 13 ------------- js/service/ItemResource.js | 10 ---------- js/tests/unit/controller/ContentControllerSpec.js | 21 +++++++-------------- templates/index.php | 1 - templates/part.content.php | 4 ++-- templates/part.navigation.sharedfeed.php | 20 -------------------- 8 files changed, 16 insertions(+), 79 deletions(-) delete mode 100644 templates/part.navigation.sharedfeed.php diff --git a/js/app/Run.js b/js/app/Run.js index 4eab8ca4d..1a1572864 100644 --- a/js/app/Run.js +++ b/js/app/Run.js @@ -17,7 +17,7 @@ app.run(function ($rootScope, $location, $http, $q, $interval, $route, Loading, // listen to keys in returned queries to automatically distribute the // incoming values to models Publisher.subscribe(ItemResource).toChannels(['items', 'newestItemId', - 'starred', 'unread', 'shared']); + 'starred', 'unread']); Publisher.subscribe(FolderResource).toChannels(['folders']); Publisher.subscribe(FeedResource).toChannels(['feeds']); Publisher.subscribe(SettingsResource).toChannels(['settings']); @@ -45,13 +45,10 @@ app.run(function ($rootScope, $location, $http, $q, $interval, $route, Loading, url = '/items/starred'; break; - case FEED_TYPE.SHARED: - url = '/items/shared'; - break; - case FEED_TYPE.EXPLORE: url = '/explore'; break; + case FEED_TYPE.UNREAD: url = '/items/unread'; break; @@ -61,7 +58,7 @@ app.run(function ($rootScope, $location, $http, $q, $interval, $route, Loading, } // only redirect if url is empty or faulty - if (!/^\/items(\/(starred|unread|shared|explore|feeds\/\d+|folders\/\d+))?\/?$/ + if (!/^\/items(\/(starred|unread|explore|feeds\/\d+|folders\/\d+))?\/?$/ .test(path)) { $location.path(url); } diff --git a/js/controller/ContentController.js b/js/controller/ContentController.js index b0478f0c4..15459c01b 100644 --- a/js/controller/ContentController.js +++ b/js/controller/ContentController.js @@ -90,10 +90,7 @@ app.controller('ContentController', function (Publisher, FeedResource, ItemResou if (!item.keepUnread && item.unread === true) { ItemResource.markItemRead(itemId); - if (item.isShared === false) { - // feeds containing shared items aren't in our cache - FeedResource.markItemOfFeedRead(item.feedId); - } + FeedResource.markItemOfFeedRead(item.feedId); } }; @@ -105,10 +102,7 @@ app.controller('ContentController', function (Publisher, FeedResource, ItemResou var item = ItemResource.get(itemId); if (!item.unread) { ItemResource.markItemRead(itemId, false); - if (item.isShared === false) { - // feeds containing shared items aren't in our cache - FeedResource.markItemOfFeedUnread(item.feedId); - } + FeedResource.markItemOfFeedUnread(item.feedId); } item.keepUnread = !item.keepUnread; @@ -143,11 +137,8 @@ app.controller('ContentController', function (Publisher, FeedResource, ItemResou itemIds.forEach(function (itemId) { var item = ItemResource.get(itemId); if (!item.keepUnread) { - if (item.isShared === false) { - // feeds containing shared items aren't in our cache - ids.push(itemId); - feedIds.push(item.feedId); - } + ids.push(itemId); + feedIds.push(item.feedId); } }); diff --git a/js/controller/NavigationController.js b/js/controller/NavigationController.js index ec86ff01a..68a46900e 100644 --- a/js/controller/NavigationController.js +++ b/js/controller/NavigationController.js @@ -113,14 +113,6 @@ app.controller('NavigationController', function ($route, FEED_TYPE, FeedResource return this.getStarredCount() > 0; }; - this.getSharedCount = function () { - return ItemResource.getSharedCount(); - }; - - this.isSharedUnread = function () { - return this.getSharedCount() > 0; - }; - this.toggleFolder = function (folderName) { FolderResource.toggleOpen(folderName); }; @@ -158,11 +150,6 @@ app.controller('NavigationController', function ($route, FEED_TYPE, FeedResource $route.current.$$route.type === FEED_TYPE.STARRED; }; - this.isSharedActive = function () { - return $route.current && - $route.current.$$route.type === FEED_TYPE.SHARED; - }; - this.isExploreActive = function () { return $route.current && $route.current.$$route.type === FEED_TYPE.EXPLORE; diff --git a/js/service/ItemResource.js b/js/service/ItemResource.js index e0b19152a..fcfd2f28d 100644 --- a/js/service/ItemResource.js +++ b/js/service/ItemResource.js @@ -20,7 +20,6 @@ app.factory('ItemResource', function (Resource, $http, BASE_URL, ITEM_BATCH_SIZE ItemResource.prototype.clear = function () { this.starredCount = 0; - this.sharedCount = 0; this.lowestId = 0; this.highestId = 0; this.fingerprints = {}; @@ -37,10 +36,6 @@ app.factory('ItemResource', function (Resource, $http, BASE_URL, ITEM_BATCH_SIZE this.starredCount = value; break; - case 'shared': - this.sharedCount = value; - break; - default: var self = this; var importValues = []; @@ -82,11 +77,6 @@ app.factory('ItemResource', function (Resource, $http, BASE_URL, ITEM_BATCH_SIZE }; - ItemResource.prototype.getSharedCount = function () { - return this.sharedCount; - }; - - ItemResource.prototype.star = function (itemId, isStarred) { if (isStarred === undefined) { isStarred = true; diff --git a/js/tests/unit/controller/ContentControllerSpec.js b/js/tests/unit/controller/ContentControllerSpec.js index e45f896f0..e8992ca8c 100644 --- a/js/tests/unit/controller/ContentControllerSpec.js +++ b/js/tests/unit/controller/ContentControllerSpec.js @@ -123,22 +123,19 @@ describe('ContentController', function () { id: 3, feedId: 4, fingerprint: 'a', - unread: true, - isShared: false + unread: true }, { id: 5, feedId: 4, fingerprint: 'b', - keepUnread: true, - isShared: false + keepUnread: true }, { id: 9, feedId: 5, fingerprint: 'c', - unread: false, - isShared: false + unread: false }] }, }); @@ -192,8 +189,7 @@ describe('ContentController', function () { id: 3, feedId: 4, unread: false, - keepUnread: true, - isShared: false + keepUnread: true }] }, }); @@ -305,21 +301,18 @@ describe('ContentController', function () { { id: 3, fingerprint: 'a', - feedId: 6, - isShared: false + feedId: 6 }, { id: 2, fingerprint: 'b', feedId: 4, - keepUnread: true, - isShared: false + keepUnread: true }, { id: 1, fingerprint: 'c', - feedId: 4, - isShared: false + feedId: 4 },] }, }); diff --git a/templates/index.php b/templates/index.php index bc4a06586..9ad38a0d5 100644 --- a/templates/index.php +++ b/templates/index.php @@ -56,7 +56,6 @@ foreach (Plugin::getScripts() as $appName => $fileName) { inc('part.navigation.addfolder')) ?> inc('part.navigation.unreadfeed')) ?> inc('part.navigation.starredfeed')) ?> - inc('part.navigation.sharedfeed')) ?> inc( 'part.navigation.feed', ['folderId' => 'null'] )) ?> diff --git a/templates/part.content.php b/templates/part.content.php index 3dcc5254e..26fbf2d8d 100644 --- a/templates/part.content.php +++ b/templates/part.content.php @@ -194,13 +194,13 @@ t('by')) ?> {{ ::item.author }} - t('from')) ?> + t('from')) ?> {{ ::Content.getFeed(item.feedId).title }} favicon - t('shared by')) ?> + t('shared by')) ?> {{ ::item.sharedBy }} diff --git a/templates/part.navigation.sharedfeed.php b/templates/part.navigation.sharedfeed.php deleted file mode 100644 index 316d83db5..000000000 --- a/templates/part.navigation.sharedfeed.php +++ /dev/null @@ -1,20 +0,0 @@ -
  • - - - t('Shared with me')) ?> - - -
    -
      -
    • - {{ Navigation.getSharedCount() | unreadCountFormatter }} -
    • -
    -
    -
  • \ No newline at end of file -- cgit v1.2.3