mirror of
https://git.ondrovo.com/MightyPork/group-actor.git
synced 2024-11-25 09:31:00 +00:00
some tweaks in help
This commit is contained in:
parent
482a93c172
commit
df197f91b7
2 changed files with 49 additions and 16 deletions
|
@ -91,7 +91,7 @@ static RE_HELP: once_cell::sync::Lazy<Regex> = Lazy::new(|| {
|
||||||
});
|
});
|
||||||
|
|
||||||
static RE_MEMBERS: once_cell::sync::Lazy<Regex> = Lazy::new(|| {
|
static RE_MEMBERS: once_cell::sync::Lazy<Regex> = Lazy::new(|| {
|
||||||
command!(r"(?:members)")
|
command!(r"(?:members|who)")
|
||||||
});
|
});
|
||||||
|
|
||||||
static RE_LEAVE: once_cell::sync::Lazy<Regex> = Lazy::new(|| {
|
static RE_LEAVE: once_cell::sync::Lazy<Regex> = Lazy::new(|| {
|
||||||
|
@ -423,6 +423,7 @@ mod test {
|
||||||
fn test_members() {
|
fn test_members() {
|
||||||
assert!(!RE_MEMBERS.is_match("/admin lain@pleroma.soykaf.com"));
|
assert!(!RE_MEMBERS.is_match("/admin lain@pleroma.soykaf.com"));
|
||||||
assert!(RE_MEMBERS.is_match("/members"));
|
assert!(RE_MEMBERS.is_match("/members"));
|
||||||
|
assert!(RE_MEMBERS.is_match("/who"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -382,28 +382,54 @@ impl GroupHandle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
StatusCommand::Help => {
|
StatusCommand::Help => {
|
||||||
|
if self.config.is_member_only() {
|
||||||
|
let mut s = "This is a member-only group. ".to_string();
|
||||||
|
if self.config.can_write(¬if_acct) {
|
||||||
|
s.push_str("*You are not a member, ask one of the admins to add you.*");
|
||||||
|
} else {
|
||||||
|
if is_admin {
|
||||||
|
s.push_str("*You are an admin.*");
|
||||||
|
} else {
|
||||||
|
s.push_str("*You are a member.*");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
replies.push(s);
|
||||||
|
} else {
|
||||||
|
let mut s = "This is a public-access group. ".to_string();
|
||||||
|
if is_admin {
|
||||||
|
s.push_str("*You are an admin.*");
|
||||||
|
}
|
||||||
|
replies.push(s);
|
||||||
|
}
|
||||||
|
|
||||||
replies.push(
|
replies.push(
|
||||||
"To share an original post with the group, mention the group user.\n\
|
"\nTo share an original post, mention the group user.\n\
|
||||||
Posts with commands won't be shared. Supported commands:\n\
|
Posts with commands, and replies, won't be shared.\n\
|
||||||
|
\n\
|
||||||
|
**Supported commands:**\n\
|
||||||
`/ignore, /i` - make the group completely ignore the post\n\
|
`/ignore, /i` - make the group completely ignore the post\n\
|
||||||
`/boost, /b` - boost the replied-to post into the group\n\
|
`/members, /who` - show group members / admins\n\
|
||||||
`/leave` - leave the group as a member".to_string());
|
`/boost, /b` - boost the replied-to post into the group".to_string());
|
||||||
|
|
||||||
|
if self.config.is_member_only() {
|
||||||
|
replies.push("`/leave` - leave the group".to_string());
|
||||||
|
}
|
||||||
|
|
||||||
if is_admin {
|
if is_admin {
|
||||||
replies.push(
|
replies.push(
|
||||||
"`/members` - list members and admins\n\
|
"`/add user` - add a member (use e-mail style address)\n\
|
||||||
`/kick, /remove user` - kick a member\n\
|
`/kick, /remove user` - kick a member\n\
|
||||||
`/add user` - add a member\n\
|
|
||||||
`/ban x` - ban a user or a server\n\
|
`/ban x` - ban a user or a server\n\
|
||||||
`/unban x` - lift a ban\n\
|
`/unban x` - lift a ban\n\
|
||||||
`/op, /admin user` - give admin rights\n\
|
`/op, /admin user` - grant admin rights\n\
|
||||||
`/deop, /deadmin user` - remove admin rights\n\
|
`/deop, /deadmin user` - revoke admin rights\n\
|
||||||
`/opengroup` - make member-only\n\
|
`/opengroup` - make member-only\n\
|
||||||
`/closegroup` - make public-access\n\
|
`/closegroup` - make public-access\n\
|
||||||
`/announce x` - make a public announcement from all that follows".to_string());
|
`/announce x` - make a public announcement from the rest of the status".to_string());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
StatusCommand::ListMembers => {
|
StatusCommand::ListMembers => {
|
||||||
|
let mut show_admins = false;
|
||||||
if is_admin {
|
if is_admin {
|
||||||
if self.config.is_member_only() {
|
if self.config.is_member_only() {
|
||||||
replies.push("Group members:".to_string());
|
replies.push("Group members:".to_string());
|
||||||
|
@ -420,6 +446,13 @@ impl GroupHandle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
show_admins = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
show_admins = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if show_admins {
|
||||||
replies.push("Group admins:".to_string());
|
replies.push("Group admins:".to_string());
|
||||||
let mut admins = self.config.get_admins().collect::<Vec<_>>();
|
let mut admins = self.config.get_admins().collect::<Vec<_>>();
|
||||||
admins.sort();
|
admins.sort();
|
||||||
|
@ -428,7 +461,6 @@ impl GroupHandle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
StatusCommand::Leave => {
|
StatusCommand::Leave => {
|
||||||
if self.config.is_member(¬if_acct) {
|
if self.config.is_member(¬if_acct) {
|
||||||
any_admin_cmd = true;
|
any_admin_cmd = true;
|
||||||
|
|
Loading…
Reference in a new issue