Skip to content

Commit

Permalink
fix(Profile): only fetch pinned on statuses view
Browse files Browse the repository at this point in the history
  • Loading branch information
GeopJr committed Jul 1, 2023
1 parent eeaa6a8 commit 9fafcdf
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions src/Views/Profile.vala
Original file line number Diff line number Diff line change
Expand Up @@ -44,34 +44,35 @@ public class Tuba.Views.Profile : Views.Timeline {
message("Destroying Profile view");
}

public void append_pinned(string acc_id = profile.id) {
new Request.GET (@"/api/v1/accounts/$(acc_id)/statuses")
.with_account (account)
.with_param ("pinned", "true")
.with_ctx (this)
.then ((sess, msg, in_stream) => {
var parser = Network.get_parser_from_inputstream(in_stream);
public bool append_pinned() {
if (source == "statuses") {
new Request.GET (@"/api/v1/accounts/$(profile.id)/statuses")
.with_account (account)
.with_param ("pinned", "true")
.with_ctx (this)
.then ((sess, msg, in_stream) => {
var parser = Network.get_parser_from_inputstream(in_stream);

Object[] to_add = {};
Network.parse_array (msg, parser, node => {
var e = entity_cache.lookup_or_insert (node, typeof (API.Status));
var e_status = e as API.Status;
if (e_status != null) e_status.pinned = true;
Object[] to_add = {};
Network.parse_array (msg, parser, node => {
var e = entity_cache.lookup_or_insert (node, typeof (API.Status));
var e_status = e as API.Status;
if (e_status != null) e_status.pinned = true;

to_add += e_status;
});
model.splice (0, 0, to_add);
to_add += e_status;
});
model.splice (0, 0, to_add);

})
.exec ();
})
.exec ();
}

return GLib.Source.REMOVE;
}

public override void on_refresh () {
base.on_refresh ();
GLib.Idle.add (() => {
append_pinned ();
return GLib.Source.REMOVE;
});
GLib.Idle.add (append_pinned);
}

[GtkTemplate (ui = "/dev/geopjr/Tuba/ui/views/profile_header.ui")]
Expand Down

0 comments on commit 9fafcdf

Please sign in to comment.