Skip to content

Commit

Permalink
feat(Timeline): only accept new posts if the initial refresh has fini…
Browse files Browse the repository at this point in the history
…shed (#596)
  • Loading branch information
GeopJr authored Oct 15, 2023
1 parent 00f2e78 commit 6c37964
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Views/Timeline.vala
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@ public class Tuba.Views.Timeline : AccountHolder, Streamable, Views.ContentBase
return req;
}

bool has_finished_request = false;
public virtual void on_request_finish () {
has_finished_request = true;
base.on_bottom_reached ();
}

Expand Down Expand Up @@ -220,6 +222,7 @@ public class Tuba.Views.Timeline : AccountHolder, Streamable, Views.ContentBase
status_button.sensitive = false;
clear ();
base_status = new StatusMessage () { loading = true };
has_finished_request = false;
GLib.Idle.add (request);
}

Expand Down Expand Up @@ -258,6 +261,8 @@ public class Tuba.Views.Timeline : AccountHolder, Streamable, Views.ContentBase
}

public virtual void on_new_post (Streamable.Event ev) {
if (!has_finished_request) return;

try {
#if USE_LISTVIEW
model.insert (0, Entity.from_json (accepts, ev.get_node ()));
Expand Down

0 comments on commit 6c37964

Please sign in to comment.