diff options
| author | Andrew Dolgov <fox@fakecake.org> | 2024-08-14 12:08:32 +0000 |
|---|---|---|
| committer | Andrew Dolgov <fox@fakecake.org> | 2024-08-14 12:08:32 +0000 |
| commit | 8cceaa873ac310fd01ce958843cc900b530f0dce (patch) | |
| tree | 7c39477de9f007ee9f5eb56118a8808190fe25a8 | |
| parent | 3496402686224f3db921c91a1b25704ef26310ca (diff) | |
| parent | d167d5803fd927cfd57c5333e1598492834dc718 (diff) | |
Merge branch 'feature/cleanup-dashboard-feed-code' into 'master'
Remove unused 'dashboard feed' code.
See merge request tt-rss/tt-rss!52
| -rw-r--r-- | classes/Feeds.php | 56 | ||||
| -rw-r--r-- | js/Feeds.js | 1 |
2 files changed, 2 insertions, 55 deletions
diff --git a/classes/Feeds.php b/classes/Feeds.php index 4b80cd336..b58c7f3b6 100644 --- a/classes/Feeds.php +++ b/classes/Feeds.php @@ -18,12 +18,9 @@ class Feeds extends Handler_Protected { const FEED_ALL = -4; /** - * a special case feed used to display auxiliary information when there's nothing to load (e.g. no stuff in fresh feed) - * - * TODO: Remove this and 'Feeds::_generate_dashboard_feed()'? It only seems to be used if 'Feeds::view()' (also potentially removable) - * gets passed the ID. + * -5 was FEED_DASHBOARD, intended to be used when there + * was nothing to show, but the related code was unused */ - const FEED_DASHBOARD = -5; /** special feed for recently read articles */ const FEED_RECENTLY_READ = -6; @@ -492,11 +489,6 @@ class Feeds extends Handler_Protected { if (is_numeric($feed)) $feed = (int) $feed; - if ($feed == Feeds::FEED_DASHBOARD) { - print json_encode($this->_generate_dashboard_feed()); - return; - } - $sth = false; if ($feed < LABEL_BASE_INDEX) { @@ -572,50 +564,6 @@ class Feeds extends Handler_Protected { } /** - * @return array<string, array<string, mixed>> - */ - private function _generate_dashboard_feed(): array { - $reply = array(); - - $reply['headlines']['id'] = Feeds::FEED_DASHBOARD; - $reply['headlines']['is_cat'] = false; - - $reply['headlines']['toolbar'] = ''; - - $reply['headlines']['content'] = "<div class='whiteBox'>".__('No feed selected.'); - - $reply['headlines']['content'] .= "<p><span class=\"text-muted\">"; - - $sth = $this->pdo->prepare("SELECT ".SUBSTRING_FOR_DATE."(MAX(last_updated), 1, 19) AS last_updated FROM ttrss_feeds - WHERE owner_uid = ?"); - $sth->execute([$_SESSION['uid']]); - $row = $sth->fetch(); - - $last_updated = TimeHelper::make_local_datetime($row["last_updated"], false); - - $reply['headlines']['content'] .= sprintf(__("Feeds last updated at %s"), $last_updated); - - $num_errors = ORM::for_table('ttrss_feeds') - ->where_not_equal('last_error', '') - ->where('owner_uid', $_SESSION['uid']) - ->where_gte('update_interval', 0) - ->count('id'); - - if ($num_errors > 0) { - $reply['headlines']['content'] .= "<br/>"; - $reply['headlines']['content'] .= "<a class=\"text-muted\" href=\"#\" onclick=\"CommonDialogs.showFeedsWithErrors(); return false\">". - __('Some feeds have update errors (click for details)')."</a>"; - } - $reply['headlines']['content'] .= "</span></p>"; - - $reply['headlines-info'] = array("count" => 0, - "unread" => 0, - "disable_cache" => true); - - return $reply; - } - - /** * @return array<string, mixed> */ private function _generate_error_feed(string $error): array { diff --git a/js/Feeds.js b/js/Feeds.js index 2cc5586b3..cecce04e2 100644 --- a/js/Feeds.js +++ b/js/Feeds.js @@ -8,7 +8,6 @@ const Feeds = { FEED_PUBLISHED: -2, FEED_FRESH: -3, FEED_ALL: -4, - FEED_DASHBOARD: -5, FEED_RECENTLY_READ: -6, FEED_ERROR: -7, CATEGORY_UNCATEGORIZED: 0, |