Also use friendly names for special feed+cat IDs in the frontend.

This commit is contained in:
wn_ 2023-03-05 20:03:35 +00:00
parent fe08299ec4
commit c923fda8c9
4 changed files with 22 additions and 9 deletions

View File

@ -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();

View File

@ -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;

View File

@ -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,

View File

@ -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'];