Browse Source

append headline buffer if requested, don't just use offset

Andrew Dolgov 8 months ago
parent
commit
8effabd075
2 changed files with 6 additions and 5 deletions
  1. 2 1
      js/Feeds.js
  2. 4 4
      js/Headlines.js

+ 2 - 1
js/Feeds.js

@@ -282,6 +282,7 @@ define(["dojo/_base/declare"], function (declare) {
 			const is_cat = !!params.is_cat || false;
 			const offset = params.offset || 0;
 			const viewfeed_debug = params.viewfeed_debug;
+			const append = params.append || false;
 			const method = params.method;
 			// this is used to quickly switch between feeds, sets active but xhr is on a timeout
 			const delayed = params.delayed || false;
@@ -349,7 +350,7 @@ define(["dojo/_base/declare"], function (declare) {
 					try {
 						window.clearTimeout(this._infscroll_timeout);
 						this.setExpando(feed, is_cat, 'images/blank_icon.gif');
-						Headlines.onLoaded(transport, offset);
+						Headlines.onLoaded(transport, offset, append);
 						PluginHost.run(PluginHost.HOOK_FEED_LOADED, [feed, is_cat]);
 					} catch (e) {
 						App.Error.report(e);

+ 4 - 4
js/Headlines.js

@@ -218,7 +218,7 @@ define(["dojo/_base/declare"], function (declare) {
 
 			console.log("loadMore, offset=", offset);
 
-			Feeds.open({feed: Feeds.getActive(), is_cat: Feeds.activeIsCat(), offset: offset});
+			Feeds.open({feed: Feeds.getActive(), is_cat: Feeds.activeIsCat(), offset: offset, append: true});
 		},
 		scrollHandler: function () {
 			try {
@@ -529,10 +529,10 @@ define(["dojo/_base/declare"], function (declare) {
 
 			return tmp.firstChild;
 		},
-		onLoaded: function (transport, offset) {
+		onLoaded: function (transport, offset, append) {
 			const reply = App.handleRpcJson(transport);
 
-			console.log("Headlines.onLoaded: offset=", offset);
+			console.log("Headlines.onLoaded: offset=", offset, "append=", append);
 
 			let is_cat = false;
 			let feed_id = false;
@@ -573,7 +573,7 @@ define(["dojo/_base/declare"], function (declare) {
 				//this.vgroup_last_feed = reply['headlines-info']['vgroup_last_feed'];
 				this.current_first_id = reply['headlines']['first_id'];
 
-				if (offset == 0) {
+				if (!append) {
 					//this.headlines = [];
 					this.vgroup_last_feed = undefined;