summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorMarco Nassabain <marco.nassabain@hotmail.com>2021-03-07 00:23:38 +0100
committerSean Molenaar <SMillerDev@users.noreply.github.com>2021-04-08 23:17:31 +0200
commit04cf2672c3a06dbaa7792403237e3ec9bbaf5455 (patch)
tree910b406b0371bfceb6cdcb729166f90acb49a6a9 /js
parent088ebcc63a892f2245c863c647516c0dd8041de7 (diff)
🎨 Adapt front-end to match new implementation
- remove share-specific code since new solution uses dummy feeds Signed-off-by: Marco Nassabain <marco.nassabain@hotmail.com>
Diffstat (limited to 'js')
-rw-r--r--js/app/Run.js9
-rw-r--r--js/controller/ContentController.js17
-rw-r--r--js/controller/NavigationController.js13
-rw-r--r--js/service/ItemResource.js10
-rw-r--r--js/tests/unit/controller/ContentControllerSpec.js21
5 files changed, 14 insertions, 56 deletions
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
},]
},
});