From: Simon Tatham Date: Thu, 14 Dec 2023 19:05:58 +0000 (+0000) Subject: First cut at viewing a user's posts. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=4e6c8289d2e2afa9f428583b11f2659e9185d8fb;p=mastodonochrome.git First cut at viewing a user's posts. --- diff --git a/client.py b/client.py index 79d5966..e24d710 100644 --- a/client.py +++ b/client.py @@ -256,6 +256,10 @@ class MentionsFeed(IncrementalServerFeed): super().__init__(client, "notifications", {"types[]":['mention']}, get=lambda item: item['status']) +class UserStatusesFeed(IncrementalServerFeed): + def __init__(self, client, account_id): + super().__init__(client, f"accounts/{account_id}/statuses", {}) + class ThreadFeed(Feed): def __init__(self, client, post_id, full): super().__init__(client) diff --git a/cursesclient.py b/cursesclient.py index c6faa11..38967c0 100644 --- a/cursesclient.py +++ b/cursesclient.py @@ -740,6 +740,8 @@ class ObjectFile(File): sl.keys.append(('S', 'Send')) # FIXME: for when we can auto-shrink bottom line # sl.keys.append(('E', 'Examine')) + if isinstance(self, UserInfoFile): + sl.keys.append(('P', 'Posts')) if self.items_are_statuses: sl.keys.append(('F', 'Fave')) sl.keys.append(('^B', 'Boost')) @@ -935,6 +937,13 @@ class UserInfoFile(ObjectFile): account = cc.get("accounts/" + account_id) return cls(cc, account) + def handle_key(self, ch): + if self.mode == 'normal' and ch in {'p', 'P'}: + feed = client.UserStatusesFeed(self.cc, self.account['id']) + name = self.cc.fq(self.account['acct']) + title = text.ColouredString(f"Posts from user {name}", 'H') + self.chain_to(StatusFile(self.cc, feed, title)) + class EditorCommon: # Common editing operations between the post editor and the line editor. # Expects self.text to be the editor buffer, and self.point to be