From 82ac1d1e676f93b1567eba608c00c6edaf401a9e Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 8 Aug 2022 12:04:02 +0200 Subject: Refactor entry-to-GReader API format (#4490) * Refactor entry to GReader API format Some code was copied in two locations and not completely uniform. Cleaning of related variables and functions (e.g. better types for entries and categories as objects vs. as IDs). Usecase: I need to call the same GReader-compatible serialization from an extension * Fixed some edge cases * Keep summary instead of content `summary` and `content` seems to be used interchangeably in the Google Reader API. We have been using `summary` for our client API and `content` in our export/import, so stick to that. --- app/views/index/normal.phtml | 4 ++-- app/views/index/reader.phtml | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'app/views/index') diff --git a/app/views/index/normal.phtml b/app/views/index/normal.phtml index 348a42e89..6a4cb77eb 100644 --- a/app/views/index/normal.phtml +++ b/app/views/index/normal.phtml @@ -37,9 +37,9 @@ $today = @strtotime('today'); $this->entry = $item; // We most likely already have the feed object in cache - $this->feed = FreshRSS_CategoryDAO::findFeed($this->categories, $this->entry->feed()); + $this->feed = FreshRSS_CategoryDAO::findFeed($this->categories, $this->entry->feedId()); if ($this->feed == null) { - $this->feed = $this->entry->feed(true); + $this->feed = $this->entry->feed(); if ($this->feed == null) { $this->feed = FreshRSS_Feed::example(); } diff --git a/app/views/index/reader.phtml b/app/views/index/reader.phtml index c9ef7fbd9..334cd4189 100644 --- a/app/views/index/reader.phtml +++ b/app/views/index/reader.phtml @@ -47,12 +47,12 @@ $MAX_TAGS_DISPLAYED = FreshRSS_Context::$user_conf->show_tags_max; } ?>
- +
categories, $item->feed()); //We most likely already have the feed object in cache - if (empty($feed)) $feed = $item->feed(true); + $feed = FreshRSS_CategoryDAO::findFeed($this->categories, $item->feedId()); //We most likely already have the feed object in cache + if ($feed == null) $feed = $item->feed(); $favoriteUrl = array('c' => 'entry', 'a' => 'bookmark', 'params' => array('id' => $item->id())); if ($item->isFavorite()) { $favoriteUrl['params']['is_favorite'] = 0; @@ -134,7 +134,7 @@ $MAX_TAGS_DISPLAYED = FreshRSS_Context::$user_conf->show_tags_max;
- +
content() ?>
-- cgit v1.2.3