Преглед на файлове

Add an automatic sticky post configuration

Before, when the article while marked as read while scrolling and auto removed after reading, the display was in the middle of the following article.
Now, the article is forced to be a sticky article so the user display is forced to be on top of the following article.
Alexis Degrugillier преди 11 години
родител
ревизия
a3a77b09e9
променени са 2 файла, в които са добавени 19 реда и са изтрити 1 реда
  1. 18 0
      app/Models/Context.php
  2. 1 1
      app/views/helpers/javascript_vars.phtml

+ 18 - 0
app/Models/Context.php

@@ -287,4 +287,22 @@ class FreshRSS_Context {
 		}
 		return true;
 	}
+
+	/**
+	 * Determine if the "sticky post" option is enabled. It can be enable
+	 * by the user when it is selected in the configuration page or by the
+	 * application when the context allows to auto-remove articles when they
+	 * are read.
+	 *
+	 * @return boolean
+	 */
+	public static function isStickyPostEnabled() {
+		if (self::$conf->sticky_post) {
+			return true;
+		}
+		if (self::isAutoRemoveAvailable()) {
+			return true;
+		}
+		return false;
+	}
 }

+ 1 - 1
app/views/helpers/javascript_vars.phtml

@@ -27,7 +27,7 @@ echo 'var context={',
 	'auto_load_more:', FreshRSS_Context::$conf->auto_load_more ? 'true' : 'false', ',',
 	'auto_actualize_feeds:', $auto_actualize ? 'true' : 'false', ',',
 	'does_lazyload:', FreshRSS_Context::$conf->lazyload ? 'true' : 'false', ',',
-	'sticky_post:', FreshRSS_Context::$conf->sticky_post ? 'true' : 'false', ',',
+	'sticky_post:', FreshRSS_Context::isStickyPostEnabled() ? 'true' : 'false', ',',
 	'html5_notif_timeout:', FreshRSS_Context::$conf->html5_notif_timeout, ',',
 	'auth_type:"', Minz_Configuration::authType(), '",',
 	'current_user_mail:', $mail ? ('"' . $mail . '"') : 'null', ',',