summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwn_ <[email protected]>2023-03-05 20:03:35 +0000
committerwn_ <[email protected]>2023-03-05 20:06:48 +0000
commitc923fda8c9b0ddc141ab1c22b35cb984c2e30f48 (patch)
tree662449d74584e54f0c3a058a93fe378c49512c0b
parentfe08299ec46eb8df2988c788ced2c019743bee6a (diff)
Also use friendly names for special feed+cat IDs in the frontend.
-rw-r--r--js/App.js10
-rwxr-xr-xjs/FeedTree.js4
-rw-r--r--js/Feeds.js13
-rwxr-xr-xjs/Headlines.js4
4 files changed, 22 insertions, 9 deletions
diff --git a/js/App.js b/js/App.js
index 262988135..dad7723ca 100644
--- a/js/App.js
+++ b/js/App.js
@@ -1198,19 +1198,19 @@ const App = {
}
};
this.hotkey_actions["goto_read"] = () => {
- Feeds.open({feed: -6});
+ Feeds.open({feed: Feeds.FEED_RECENTLY_READ});
};
this.hotkey_actions["goto_all"] = () => {
- Feeds.open({feed: -4});
+ Feeds.open({feed: Feeds.FEED_ALL});
};
this.hotkey_actions["goto_fresh"] = () => {
- Feeds.open({feed: -3});
+ Feeds.open({feed: Feeds.FEED_FRESH});
};
this.hotkey_actions["goto_marked"] = () => {
- Feeds.open({feed: -1});
+ Feeds.open({feed: Feeds.FEED_STARRED});
};
this.hotkey_actions["goto_published"] = () => {
- Feeds.open({feed: -2});
+ Feeds.open({feed: Feeds.FEED_PUBLISHED});
};
this.hotkey_actions["goto_prefs"] = () => {
App.openPreferences();
diff --git a/js/FeedTree.js b/js/FeedTree.js
index f6c44a71e..3eaa61263 100755
--- a/js/FeedTree.js
+++ b/js/FeedTree.js
@@ -225,8 +225,8 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dojo/_base/array", "dojo/co
if (item.auxcounter > 0) rc += " Has_Aux";
if (item.markedcounter > 0) rc += " Has_Marked";
if (item.updates_disabled > 0) rc += " UpdatesDisabled";
- if (item.bare_id >= App.LABEL_BASE_INDEX && item.bare_id < 0 && !is_cat || item.bare_id == 0 && !is_cat) rc += " Special";
- if (item.bare_id == -1 && is_cat) rc += " AlwaysVisible";
+ if (item.bare_id >= App.LABEL_BASE_INDEX && item.bare_id < 0 && !is_cat || item.bare_id == Feeds.FEED_ARCHIVED && !is_cat) rc += " Special";
+ if (item.bare_id == Feeds.CATEGORY_SPECIAL && is_cat) rc += " AlwaysVisible";
if (item.bare_id < App.LABEL_BASE_INDEX) rc += " Label";
return rc;
diff --git a/js/Feeds.js b/js/Feeds.js
index 42641dc74..d84255310 100644
--- a/js/Feeds.js
+++ b/js/Feeds.js
@@ -3,6 +3,19 @@
/* global __, App, Headlines, xhr, dojo, dijit, fox, PluginHost, Notify, fox */
const Feeds = {
+ FEED_ARCHIVED: 0,
+ FEED_STARRED: -1,
+ FEED_PUBLISHED: -2,
+ FEED_FRESH: -3,
+ FEED_ALL: -4,
+ FEED_NOTHING: -5,
+ FEED_RECENTLY_READ: -6,
+ FEED_ERROR: -7,
+ CATEGORY_UNCATEGORIZED: 0,
+ CATEGORY_SPECIAL: -1,
+ CATEGORY_LABELS: -2,
+ CATEGORY_ALL_EXCEPT_VIRTUAL: -3,
+ CATEGORY_ALL: -4,
_default_feed_id: -3,
counters_last_request: 0,
_active_feed_id: undefined,
diff --git a/js/Headlines.js b/js/Headlines.js
index 2be3cd697..be17bf832 100755
--- a/js/Headlines.js
+++ b/js/Headlines.js
@@ -307,7 +307,7 @@ const Headlines = {
offset = unread_in_buffer;
break;
case "adaptive":
- if (!(Feeds.getActive() == -1 && !Feeds.activeIsCat()))
+ if (!(Feeds.getActive() == Feeds.FEED_STARRED && !Feeds.activeIsCat()))
offset = num_unread > 0 ? unread_in_buffer : num_all;
break;
}
@@ -746,7 +746,7 @@ const Headlines = {
feed_id = reply['headlines']['id'];
Feeds.last_search_query = reply['headlines']['search_query'];
- if (feed_id != -7 && (feed_id != Feeds.getActive() || is_cat != Feeds.activeIsCat()))
+ if (feed_id != Feeds.FEED_ERROR && (feed_id != Feeds.getActive() || is_cat != Feeds.activeIsCat()))
return;
const headlines_count = reply['headlines-info']['count'];