chiark / gitweb /
First cut at viewing a user's posts.
authorSimon Tatham <anakin@pobox.com>
Thu, 14 Dec 2023 19:05:58 +0000 (19:05 +0000)
committerSimon Tatham <anakin@pobox.com>
Thu, 14 Dec 2023 19:05:58 +0000 (19:05 +0000)
client.py
cursesclient.py

index 79d5966642657de83381e1fc32e0134e044af07d..e24d7108d655178ffcd206964ef5db3a24930d42 100644 (file)
--- 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)
index c6faa1146f47f46d15d0443314c07c2fab477c28..38967c0221d153fd71741c3bba001d3301930613 100644 (file)
@@ -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