From 1479b00980602467c8b5cd96212bfa60a02e4e0e Mon Sep 17 00:00:00 2001 From: Evangelos Paterakis Date: Sat, 21 Jan 2023 18:27:46 +0200 Subject: [PATCH] feat(profile): prepend pinned posts --- src/Views/Profile.vala | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Views/Profile.vala b/src/Views/Profile.vala index 76f9f8c..b23ae9a 100644 --- a/src/Views/Profile.vala +++ b/src/Views/Profile.vala @@ -36,11 +36,27 @@ public class Tooth.Views.Profile : Views.Timeline { is_profile: true, url: @"/api/v1/accounts/$(acc.id)/statuses" ); + append_pinned(acc.id); cover.bind (profile); build_profile_stats(cover.info); rs.invalidated.connect (on_rs_updated); } + public void append_pinned(string acc_id) { + new Request.GET (@"/api/v1/accounts/$(acc_id)/statuses") + .with_account (account) + .with_param ("pinned", "true") + .with_ctx (this) + .then ((sess, msg) => { + Network.parse_array (msg, node => { + var e = entity_cache.lookup_or_insert (node, typeof (API.Status)); + (e as API.Status).pinned = true; + model.append (e); //FIXME: use splice(); + }); + }) + .exec (); + } + [GtkTemplate (ui = "/dev/geopjr/tooth/ui/views/profile_header.ui")] protected class Cover : Box {