chiark / gitweb /
Show pending follow requests on the Main Menu.
authorSimon Tatham <anakin@pobox.com>
Sat, 3 Feb 2024 11:47:59 +0000 (11:47 +0000)
committerSimon Tatham <anakin@pobox.com>
Sat, 3 Feb 2024 11:51:20 +0000 (11:51 +0000)
Now you can find out _that_ you have pending requests, in order to go
through the procedure of accepting or rejecting them.

I'm not 100% sure this is the best thing for all users of locked
accounts, so I've left in a TODO item for 'maybe there should be a
method of proactively notifying you of incoming requests'. But this
completes the initial implementation of _something_ that's usable.

TODO.md
src/menu.rs

diff --git a/TODO.md b/TODO.md
index e246827ae6a6e8cb7ce56a186d5058b3d4185420..59f33249443ae4ea25745d786b4c592b2633f1f5 100644 (file)
--- a/TODO.md
+++ b/TODO.md
@@ -1,3 +1,6 @@
+Mastodonochrome's TODO list
+===========================
+
 # Missing features
 
 ## Verbose help
@@ -305,28 +308,14 @@ posts to show up in your notifications feed. Perhaps we should support
 setting that flag on a user, and receiving the resulting notifications
 in some useful part of the API?
 
-### Locked accounts
-
-You can lock your account so that people can only follow you if you
-give permission. We already support actually _doing_ this -- it's one
-of the options in the \[ESC\]\[Y\]\[O\] options menu. But there's more
-to do to make sure this works well:
-
-* put follow requests into some kind of notifications feed that causes
-  you to hear about them
-* allow you to [get a list of your current pending
-  requests](https://docs.joinmastodon.org/methods/follow_requests/#get),
-  in the same format as actual followers, so that from there, you can
-  examine requesting users in the normal way
-* when examining a user who is a pending requester, there should be
-  options to
-  [accept](https://docs.joinmastodon.org/methods/follow_requests/#accept)
-  or
-  [reject](https://docs.joinmastodon.org/methods/follow_requests/#reject)
-  the request
-* support sending follow requests to a locked account (IDK if this is
-  the same as 'follow'; if so, perhaps you get back a Relationship
-  that says `requested` rather than `following`?)
+### Being notified of follow requests
+
+At the moment, if your account is locked and someone requests to
+follow you, you find out via an indication on the Main Menu. But maybe
+some locked-account users would prefer an immediate notification, via
+a feed you get thrown into like \[ESC\]\[R\]? Without talking to some,
+I don't know whether that would be useful, so I haven't implemented it
+yet.
 
 ### General search
 
index 5a185b62da709a1c05770036319a7adc3f403110..25a197eb6428ea3c50b233ff5bd9eeb57ce36fdc 100644 (file)
@@ -210,7 +210,7 @@ impl ActivityState for Menu {
     }
 }
 
-pub fn main_menu(client: &Client) -> Box<dyn ActivityState> {
+pub fn main_menu(client: &mut Client) -> Box<dyn ActivityState> {
     let mut menu = Menu::new(
         ColouredString::uniform("Mastodonochrome Main Menu", 'H'),
         true,
@@ -264,6 +264,26 @@ pub fn main_menu(client: &Client) -> Box<dyn ActivityState> {
             'r',
         ));
     }
+    if let Some(n) = client
+        .account_by_id(&client.our_account_id())
+        .ok()
+        .and_then(|ac| ac.source)
+        .map(|s| s.follow_requests_count)
+    {
+        menu.add_info_coloured(
+            ColouredString::uniform(
+                &format!(
+                    "You have {} pending follow request{}!",
+                    n,
+                    if n == 1 { "" } else { "s" },
+                ),
+                'F',
+            ) + ColouredString::general(
+                " View with [ESC][Y][L][R]",
+                " HHHHHHHHHHHKKKHHKHHKHHKH",
+            ),
+        );
+    }
 
     Box::new(menu.finalise())
 }