From adaec6176ca04ee38306bd348eba9a8350f19405 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Tue, 2 Dec 2014 23:34:31 -0500 Subject: Add article auto-remove after clicking on the read link --- p/scripts/main.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/p/scripts/main.js b/p/scripts/main.js index d1d31c801..19eba206d 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -690,6 +690,9 @@ function init_stream(divStream) { divStream.on('click', '.flux a.read', function () { var active = $(this).parents(".flux"); mark_read(active, false); + if (context['auto_remove_article']) { + active.remove(); + } return false; }); -- cgit v1.2.3 From 7161eacb4042de4fd994b727800038d3ec286374 Mon Sep 17 00:00:00 2001 From: Alwaysin Date: Wed, 3 Dec 2014 23:42:38 +0100 Subject: Add i18n (french) for auto_remove_article #2 Reference : #694 --- app/i18n/fr/gen.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/i18n/fr/gen.php b/app/i18n/fr/gen.php index 8a4a9750b..0b2395bd0 100644 --- a/app/i18n/fr/gen.php +++ b/app/i18n/fr/gen.php @@ -62,6 +62,7 @@ return array( 'author' => 'Auteur', 'auto_load_more' => 'Charger les articles suivants en bas de page', 'auto_read_when' => 'Marquer un article comme lu…', + 'auto_remove_article' => 'Cacher les articles après lecture', 'auto_share' => 'Partager', 'auto_share_help' => 'S’il n’y a qu’un mode de partage, celui-ci est utilisé automatiquement. Sinon ils sont accessibles par leur numéro.', 'back_to_rss_feeds' => '← Retour à vos flux RSS', -- cgit v1.2.3 From 93af0cf61e6e9368888eedb2d2e36397da3f87bd Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Wed, 3 Dec 2014 18:13:59 -0500 Subject: Fix behavior when marking an article as unread --- p/scripts/main.js | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/p/scripts/main.js b/p/scripts/main.js index 19eba206d..32cf55a3c 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -144,6 +144,7 @@ function mark_read(active, only_not_read) { inc = 0; if (active.hasClass("not_read")) { active.removeClass("not_read"); + hide_article(active); inc--; } else if (only_not_read !== true || active.hasClass("not_read")) { active.addClass("not_read"); @@ -231,14 +232,7 @@ function toggleContent(new_active, old_active) { } old_active.removeClass("active current"); new_active.addClass("current"); - if (context['auto_remove_article'] && !old_active.hasClass('not_read')) { - var p = old_active.prev(); - var n = old_active.next(); - if (p.hasClass('day') && n.hasClass('day')) { - p.remove(); - } - old_active.remove(); - } + hide_article(old_active); } else { new_active.toggleClass('active'); } @@ -283,6 +277,17 @@ function toggleContent(new_active, old_active) { } } +function hide_article(article) { + if (context['auto_remove_article'] && !article.hasClass('not_read')) { + var p = article.prev(); + var n = article.next(); + if (p.hasClass('day') && n.hasClass('day')) { + p.remove(); + } + article.remove(); + } +} + function prev_entry() { var old_active = $(".flux.current"), new_active = old_active.length === 0 ? $(".flux:last") : old_active.prevAll(".flux:first"); @@ -690,9 +695,6 @@ function init_stream(divStream) { divStream.on('click', '.flux a.read', function () { var active = $(this).parents(".flux"); mark_read(active, false); - if (context['auto_remove_article']) { - active.remove(); - } return false; }); -- cgit v1.2.3 From 5617911644bf85718430bb096c4ae9a0a0e8c75c Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Wed, 3 Dec 2014 18:35:42 -0500 Subject: Revert "Fix behavior when marking an article as unread" This reverts commit 93af0cf61e6e9368888eedb2d2e36397da3f87bd. --- p/scripts/main.js | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/p/scripts/main.js b/p/scripts/main.js index 32cf55a3c..19eba206d 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -144,7 +144,6 @@ function mark_read(active, only_not_read) { inc = 0; if (active.hasClass("not_read")) { active.removeClass("not_read"); - hide_article(active); inc--; } else if (only_not_read !== true || active.hasClass("not_read")) { active.addClass("not_read"); @@ -232,7 +231,14 @@ function toggleContent(new_active, old_active) { } old_active.removeClass("active current"); new_active.addClass("current"); - hide_article(old_active); + if (context['auto_remove_article'] && !old_active.hasClass('not_read')) { + var p = old_active.prev(); + var n = old_active.next(); + if (p.hasClass('day') && n.hasClass('day')) { + p.remove(); + } + old_active.remove(); + } } else { new_active.toggleClass('active'); } @@ -277,17 +283,6 @@ function toggleContent(new_active, old_active) { } } -function hide_article(article) { - if (context['auto_remove_article'] && !article.hasClass('not_read')) { - var p = article.prev(); - var n = article.next(); - if (p.hasClass('day') && n.hasClass('day')) { - p.remove(); - } - article.remove(); - } -} - function prev_entry() { var old_active = $(".flux.current"), new_active = old_active.length === 0 ? $(".flux:last") : old_active.prevAll(".flux:first"); @@ -695,6 +690,9 @@ function init_stream(divStream) { divStream.on('click', '.flux a.read', function () { var active = $(this).parents(".flux"); mark_read(active, false); + if (context['auto_remove_article']) { + active.remove(); + } return false; }); -- cgit v1.2.3 From 53410887c94157f3d11f2c30d92ff5d3d8a3a9bd Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Wed, 3 Dec 2014 18:57:53 -0500 Subject: Fix behavior to hide articles I do not like it since it is partly duplicated. We need to find something better. --- p/scripts/main.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/p/scripts/main.js b/p/scripts/main.js index 19eba206d..e48630d89 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -689,10 +689,15 @@ function init_stream(divStream) { divStream.on('click', '.flux a.read', function () { var active = $(this).parents(".flux"); - mark_read(active, false); - if (context['auto_remove_article']) { + if (context['auto_remove_article'] && active.hasClass('not_read')) { + var p = active.prev(); + var n = active.next(); + if (p.hasClass('day') && n.hasClass('day')) { + p.remove(); + } active.remove(); } + mark_read(active, false); return false; }); -- cgit v1.2.3 From 2a74b9e9a69fcfe74b513c487430669540ef18fc Mon Sep 17 00:00:00 2001 From: Alwaysin Date: Fri, 5 Dec 2014 09:41:54 +0100 Subject: Add i18n (english) for auto_remove_article #2 Reference : https://github.com/FreshRSS/FreshRSS/pull/694 --- app/i18n/en/gen.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/i18n/en/gen.php b/app/i18n/en/gen.php index 9e06357bc..5dc2c3e28 100644 --- a/app/i18n/en/gen.php +++ b/app/i18n/en/gen.php @@ -62,6 +62,7 @@ return array( 'author' => 'Author', 'auto_load_more' => 'Load next articles at the page bottom', 'auto_read_when' => 'Mark article as read…', + 'auto_remove_article' => 'Hide articles after reading' 'auto_share' => 'Share', 'auto_share_help' => 'If there is only one sharing mode, it is used. Else modes are accessible by their number.', 'back_to_rss_feeds' => '← Go back to your RSS feeds', -- cgit v1.2.3 From 6a706c95df557d1897608c89d3f5e0d0e9cd20ac Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Fri, 5 Dec 2014 07:07:23 -0500 Subject: fix typo --- app/i18n/en/gen.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/i18n/en/gen.php b/app/i18n/en/gen.php index 5dc2c3e28..a7f51e8f9 100644 --- a/app/i18n/en/gen.php +++ b/app/i18n/en/gen.php @@ -62,7 +62,7 @@ return array( 'author' => 'Author', 'auto_load_more' => 'Load next articles at the page bottom', 'auto_read_when' => 'Mark article as read…', - 'auto_remove_article' => 'Hide articles after reading' + 'auto_remove_article' => 'Hide articles after reading', 'auto_share' => 'Share', 'auto_share_help' => 'If there is only one sharing mode, it is used. Else modes are accessible by their number.', 'back_to_rss_feeds' => '← Go back to your RSS feeds', -- cgit v1.2.3 From eaaf8cdbf1e87ad22d25257eb99a4b80b579e661 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sat, 6 Dec 2014 10:15:34 -0500 Subject: Add comments --- app/Models/EntryDAO.php | 77 +++++++++++++++++++++++++++++++++++++++++++ app/Models/EntryDAOSQLite.php | 45 +++++++++++++++++++++++++ 2 files changed, 122 insertions(+) diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index 5d2909c62..4d06ac028 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -80,6 +80,16 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { return -1; } + /** + * Toggle favorite marker on one or more article + * + * @todo simplify the query by removing the str_repeat. I am pretty sure + * there is an other way to do that. + * + * @param integer|array $ids + * @param boolean $is_favorite + * @return false|integer + */ public function markFavorite($ids, $is_favorite = true) { if (!is_array($ids)) { $ids = array($ids); @@ -99,6 +109,17 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { } } + /** + * Update the unread article cache held on every feed details. + * Depending on the parameters, it updates the cache on one feed, on all + * feeds from one category or on all feeds. + * + * @todo It can use the query builder refactoring to build that query + * + * @param false|integer $catId category ID + * @param false|integer $feedId feed ID + * @return boolean + */ protected function updateCacheUnreads($catId = false, $feedId = false) { $sql = 'UPDATE `' . $this->prefix . 'feed` f ' . 'LEFT OUTER JOIN (' @@ -129,6 +150,19 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { } } + /** + * Toggle the read marker on one or more article. + * Then the cache is updated. + * + * @todo change the way the query is build because it seems there is + * unnecessary code in here. For instance, the part with the str_repeat. + * @todo remove code duplication. It seems the code is basically the + * same if it is an array or not. + * + * @param integer|array $ids + * @param boolean $is_read + * @return integer affected rows + */ public function markRead($ids, $is_read = true) { if (is_array($ids)) { //Many IDs at once (used by API) if (count($ids) < 6) { //Speed heuristics @@ -172,6 +206,27 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { } } + /** + * Mark all entries as read depending on parameters. + * If $onlyFavorites is true, it is used when the user mark as read in + * the favorite pseudo-category. + * If $priorityMin is greater than 0, it is used when the user mark as + * read in the main feed pseudo-category. + * Then the cache is updated. + * + * If $idMax equals 0, a deprecated debug message is logged + * + * @todo refactor this method along with markReadCat and markReadFeed + * since they are all doing the same thing. I think we need to build a + * tool to generate the query instead of having queries all over the + * place. It will be reused also for the filtering making every thing + * separated. + * + * @param integer $idMax fail safe article ID + * @param boolean $onlyFavorites + * @param integer $priorityMin + * @return integer affected rows + */ public function markReadEntries($idMax = 0, $onlyFavorites = false, $priorityMin = 0) { if ($idMax == 0) { $idMax = time() . '000000'; @@ -200,6 +255,17 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { return $affected; } + /** + * Mark all the articles in a category as read. + * There is a fail safe to prevent to mark as read articles that are + * loaded during the mark as read action. Then the cache is updated. + * + * If $idMax equals 0, a deprecated debug message is logged + * + * @param integer $id category ID + * @param integer $idMax fail safe article ID + * @return integer affected rows + */ public function markReadCat($id, $idMax = 0) { if ($idMax == 0) { $idMax = time() . '000000'; @@ -223,6 +289,17 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { return $affected; } + /** + * Mark all the articles in a feed as read. + * There is a fail safe to prevent to mark as read articles that are + * loaded during the mark as read action. Then the cache is updated. + * + * If $idMax equals 0, a deprecated debug message is logged + * + * @param integer $id feed ID + * @param integer $idMax fail safe article ID + * @return integer affected rows + */ public function markReadFeed($id, $idMax = 0) { if ($idMax == 0) { $idMax = time() . '000000'; diff --git a/app/Models/EntryDAOSQLite.php b/app/Models/EntryDAOSQLite.php index 4a3fe24a2..bb1539e0c 100644 --- a/app/Models/EntryDAOSQLite.php +++ b/app/Models/EntryDAOSQLite.php @@ -31,6 +31,19 @@ class FreshRSS_EntryDAOSQLite extends FreshRSS_EntryDAO { } } + /** + * Toggle the read marker on one or more article. + * Then the cache is updated. + * + * @todo change the way the query is build because it seems there is + * unnecessary code in here. For instance, the part with the str_repeat. + * @todo remove code duplication. It seems the code is basically the + * same if it is an array or not. + * + * @param integer|array $ids + * @param boolean $is_read + * @return integer affected rows + */ public function markRead($ids, $is_read = true) { if (is_array($ids)) { //Many IDs at once (used by API) if (true) { //Speed heuristics //TODO: Not implemented yet for SQLite (so always call IDs one by one) @@ -69,6 +82,27 @@ class FreshRSS_EntryDAOSQLite extends FreshRSS_EntryDAO { } } + /** + * Mark all entries as read depending on parameters. + * If $onlyFavorites is true, it is used when the user mark as read in + * the favorite pseudo-category. + * If $priorityMin is greater than 0, it is used when the user mark as + * read in the main feed pseudo-category. + * Then the cache is updated. + * + * If $idMax equals 0, a deprecated debug message is logged + * + * @todo refactor this method along with markReadCat and markReadFeed + * since they are all doing the same thing. I think we need to build a + * tool to generate the query instead of having queries all over the + * place. It will be reused also for the filtering making every thing + * separated. + * + * @param integer $idMax fail safe article ID + * @param boolean $onlyFavorites + * @param integer $priorityMin + * @return integer affected rows + */ public function markReadEntries($idMax = 0, $onlyFavorites = false, $priorityMin = 0) { if ($idMax == 0) { $idMax = time() . '000000'; @@ -95,6 +129,17 @@ class FreshRSS_EntryDAOSQLite extends FreshRSS_EntryDAO { return $affected; } + /** + * Mark all the articles in a category as read. + * There is a fail safe to prevent to mark as read articles that are + * loaded during the mark as read action. Then the cache is updated. + * + * If $idMax equals 0, a deprecated debug message is logged + * + * @param integer $id category ID + * @param integer $idMax fail safe article ID + * @return integer affected rows + */ public function markReadCat($id, $idMax = 0) { if ($idMax == 0) { $idMax = time() . '000000'; -- cgit v1.2.3 From a596385343a0307bb81d1662f78106d8f7e2dbfb Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Mon, 8 Dec 2014 12:37:06 +0100 Subject: Fix a security issue in Minz_Error::error() Mehtod must redirect automatically by default to avoid code execution after calling the method. --- lib/Minz/Error.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Minz/Error.php b/lib/Minz/Error.php index c8222a430..e5f3dff07 100644 --- a/lib/Minz/Error.php +++ b/lib/Minz/Error.php @@ -19,7 +19,7 @@ class Minz_Error { * > $logs['notice'] * @param $redirect indique s'il faut forcer la redirection (les logs ne seront pas transmis) */ - public static function error ($code = 404, $logs = array (), $redirect = false) { + public static function error ($code = 404, $logs = array (), $redirect = true) { $logs = self::processLogs ($logs); $error_filename = APP_PATH . '/Controllers/errorController.php'; -- cgit v1.2.3 From 70c1f0ebb08e2edf1721e2d3f8f98837c5910da4 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Tue, 9 Dec 2014 12:43:33 +0100 Subject: Fix redirection after feed refresh Fix https://github.com/FreshRSS/FreshRSS/issues/716 --- app/Controllers/feedController.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 9990a852c..c8727c727 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -392,8 +392,9 @@ class FreshRSS_feed_Controller extends Minz_ActionController { // Redirect to the main page with correct notification. if ($updated_feeds === 1) { $feed = reset($feeds); - Minz_Request::good(_t('feed_actualized', $feed->name()), - array('get' => 'f_' . $feed->id())); + Minz_Request::good(_t('feed_actualized', $feed->name()), array( + 'params' => array('get' => 'f_' . $feed->id()) + )); } elseif ($updated_feeds > 1) { Minz_Request::good(_t('n_feeds_actualized', $updated_feeds), array()); } else { -- cgit v1.2.3 From 0b9fa9896ed3b12b7e0d6300f0122d25d9576aa3 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Tue, 9 Dec 2014 15:44:13 +0100 Subject: Update CHANGELOG --- CHANGELOG | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index e09b55d21..15582e82a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,11 +1,24 @@ # Journal des modifications -## Dev +## 2014-12-xx FreshRSS 0.9.3 (beta) * SimplePie * Support for content-type application/x-rss+xml * New force_feed option (for feeds sent with the wrong content-type / MIME) by adding #force_feed at the end of the feed URL * Improved error messages +* Statistics + * Add information on feed repartition pages + * Add percent repartition for the bigger feeds +* UI + * New theme selector + * Update Screwdriver theme + * Add BlueLagoon theme by Mister aiR +* Misc. + * Add option to remove articles after reading them + * Add comments + * Refactor i18n system to not load unnecessary strings + * Fix security issue in Minz_Error::error() method + * Fix redirection after refreshing a given feed ## 2014-10-31 FreshRSS 0.9.2 (beta) -- cgit v1.2.3