enum CanList {
Nothing,
ForPost,
- ForUser,
+
+ // true if the account is your own, and also locked, so that we
+ // also need a third option to list follow _requesters_
+ ForUser(bool),
}
trait FileType {
)
}
UIMode::ListSubmenu => {
- let fs = match self.file_desc.can_list() {
- CanList::ForUser => fs
- .add(Pr('I'), "List Followers", 99)
- .add(Pr('O'), "List Followed", 99),
- CanList::ForPost => fs
- .add(Pr('F'), "List Favouriters", 99)
- .add(Pr('B'), "List Boosters", 99),
- CanList::Nothing => {
- panic!("Then we shouldn't be in this submenu")
- }
- };
+ let fs =
+ match self.file_desc.can_list() {
+ CanList::ForUser(locked) => {
+ let fs = fs
+ .add(Pr('I'), "List Followers", 98)
+ .add(Pr('O'), "List Followed", 98);
+ if locked {
+ fs.add(Pr('R'), "List Requesters", 99)
+ } else {
+ fs
+ }
+ }
+ CanList::ForPost => fs
+ .add(Pr('F'), "List Favouriters", 99)
+ .add(Pr('B'), "List Boosters", 99),
+ CanList::Nothing => {
+ panic!("Then we shouldn't be in this submenu")
+ }
+ };
fs.add(Pr('Q'), "Quit", 100)
}
UIMode::PostsSubmenu => {
}
Pr('i') | Pr('I') => {
- if self.file_desc.can_list() == CanList::ForUser {
+ if let CanList::ForUser(_) = self.file_desc.can_list() {
LogicalAction::Goto(
UtilityActivity::ListUserFollowers(
self.contents.source.single_id(),
}
Pr('o') | Pr('O') => {
- if self.file_desc.can_list() == CanList::ForUser {
+ if let CanList::ForUser(_) = self.file_desc.can_list() {
LogicalAction::Goto(
UtilityActivity::ListUserFollowees(
self.contents.source.single_id(),
}
}
+ Pr('r') | Pr('R') => {
+ if self.file_desc.can_list() == CanList::ForUser(true) {
+ LogicalAction::Goto(
+ UtilityActivity::ListFollowRequesters.into(),
+ )
+ } else {
+ LogicalAction::Nothing
+ }
+ }
+
Pr('q') | Pr('Q') => {
self.ui_mode = UIMode::Normal;
LogicalAction::Nothing
Ok(Box::new(file))
}
+pub fn list_follow_requesters(
+ client: &mut Client,
+) -> Result<Box<dyn ActivityState>, ClientError> {
+ let name = client.our_account_fq();
+
+ let file = File::new(
+ client,
+ FeedSource::new(FeedId::YourFollowRequesters),
+ ColouredString::uniform(
+ &format!("Users who have requested to follow {name}"),
+ 'H',
+ ),
+ UserListFeedType {},
+ None,
+ None,
+ false,
+ )?;
+ Ok(Box::new(file))
+}
+
pub fn hashtag_timeline(
unfolded: Rc<RefCell<HashSet<String>>>,
client: &mut Client,
Ok(Box::new(file))
}
-struct ExamineUserFileType {}
+struct ExamineUserFileType {
+ locked: bool,
+}
impl FileType for ExamineUserFileType {
type Item = ExamineUserDisplay;
const CAN_GET_POSTS: bool = true;
}
fn can_list(&self) -> CanList {
- CanList::ForUser
+ CanList::ForUser(self.locked)
}
}
account_id: &str,
) -> Result<Box<dyn ActivityState>, ClientError> {
let ac = client.account_by_id(account_id)?;
+ let locked = ac.id == client.our_account_id() && ac.locked;
let username = client.fq(&ac.acct);
let title = ColouredString::uniform(
&format!("Information about user {username}"),
client,
StaticSource::singleton(ac.id),
title,
- ExamineUserFileType {},
+ ExamineUserFileType { locked },
Some(&FilePosition::item_top(isize::MIN).into()),
None,
false,