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(|| { 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(|| { static RE_OPEN_GROUP: once_cell::sync::Lazy<Regex> = Lazy::new(|| {
@ -379,11 +379,10 @@ mod test {
fn test_remove_admin() { fn test_remove_admin() {
assert!(!RE_REVOKE_ADMIN.is_match("/admin lain@pleroma.soykaf.com")); 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("/deop @lain"));
assert!(RE_REVOKE_ADMIN.is_match("/deadmin @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!(c.is_some());
assert_eq!(c.unwrap().get(1).unwrap().as_str(), "@lain"); assert_eq!(c.unwrap().get(1).unwrap().as_str(), "@lain");
} }

View file

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