improvements

This commit is contained in:
Ondřej Hruška 2021-08-22 12:07:05 +02:00
parent 84ff6a8ae2
commit cf61f21d42
No known key found for this signature in database
GPG key ID: 2C5FD5035250423D
2 changed files with 20 additions and 17 deletions

View file

@ -75,7 +75,7 @@ static RE_GRANT_ADMIN: once_cell::sync::Lazy<Regex> = Lazy::new(|| {
});
static RE_REVOKE_ADMIN: once_cell::sync::Lazy<Regex> = Lazy::new(|| {
command!(r"(?:deop|deadmin|revoke)\s+", p_user!())
command!(r"(?:deop|deadmin)\s+", p_user!())
});
static RE_OPEN_GROUP: once_cell::sync::Lazy<Regex> = Lazy::new(|| {
@ -379,11 +379,10 @@ mod test {
fn test_remove_admin() {
assert!(!RE_REVOKE_ADMIN.is_match("/admin lain@pleroma.soykaf.com"));
assert!(RE_REVOKE_ADMIN.is_match("/revoke @lain"));
assert!(RE_REVOKE_ADMIN.is_match("/deop @lain"));
assert!(RE_REVOKE_ADMIN.is_match("/deadmin @lain"));
let c = RE_REVOKE_ADMIN.captures("/revoke @lain");
let c = RE_REVOKE_ADMIN.captures("/deadmin @lain");
assert!(c.is_some());
assert_eq!(c.unwrap().get(1).unwrap().as_str(), "@lain");
}

View file

@ -382,21 +382,25 @@ impl GroupHandle {
}
}
StatusCommand::Help => {
replies.push("Mention the group user in a top-level post to share it with the group's members.".to_string());
replies.push("Posts with commands won't be shared. Supported commands:".to_string());
replies.push("/ignore, /ign, /i - don't run any commands in the post".to_string());
replies.push("/boost, /b - boost the replied-to post into the group".to_string());
replies.push("/leave - leave the group as a member".to_string());
replies.push(
"To share an original post with the group, mention the group user.\n\
Posts with commands won't be shared. Supported commands:\n\
`/ignore, /i` - make the group completely ignore the post\n\
`/boost, /b` - boost the replied-to post into the group\n\
`/leave` - leave the group as a member".to_string());
if is_admin {
replies.push("/members".to_string());
replies.push("/kick, /remove user - kick a member".to_string());
replies.push("/add user - add a member".to_string());
replies.push("/ban x - ban a user or a server".to_string());
replies.push("/unban x - lift a ban".to_string());
replies.push("/op, /admin user - give admin rights".to_string());
replies.push("/unop, /unadmin user - remove admin rights".to_string());
replies.push("/opengroup, /closegroup - control posting access".to_string());
replies.push(
"`/members` - list members and admins\n\
`/kick, /remove user` - kick a member\n\
`/add user` - add a member\n\
`/ban x` - ban a user or a server\n\
`/unban x` - lift a ban\n\
`/op, /admin user` - give admin rights\n\
`/deop, /deadmin user` - remove admin rights\n\
`/opengroup` - make member-only\n\
`/closegroup` - make public-access\n\
`/announce x` - make a public announcement from all that follows".to_string());
}
}
StatusCommand::ListMembers => {
@ -486,7 +490,7 @@ impl GroupHandle {
Admins: {admins}", user = notif_acct, admins = admins.join(", "))
} else {
format!(
"@{user} welcome to the group! This is a public-access group. \
"@{user} welcome to the group! \
To share a post, tag the group user. Use /help for more info.", user = notif_acct)
};