From: Simon Tatham Date: Sat, 3 Feb 2024 11:47:59 +0000 (+0000) Subject: Show pending follow requests on the Main Menu. X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=fa5c04dabbfff28da0bb6ee8401ed48fe5d9a598;p=mastodonochrome.git Show pending follow requests on the Main Menu. 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. --- diff --git a/TODO.md b/TODO.md index e246827..59f3324 100644 --- 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 diff --git a/src/menu.rs b/src/menu.rs index 5a185b6..25a197e 100644 --- a/src/menu.rs +++ b/src/menu.rs @@ -210,7 +210,7 @@ impl ActivityState for Menu { } } -pub fn main_menu(client: &Client) -> Box { +pub fn main_menu(client: &mut Client) -> Box { let mut menu = Menu::new( ColouredString::uniform("Mastodonochrome Main Menu", 'H'), true, @@ -264,6 +264,26 @@ pub fn main_menu(client: &Client) -> Box { '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()) }