mirror of
https://git.ondrovo.com/MightyPork/group-actor.git
synced 2024-11-21 15:41:03 +00:00
nobot fix
This commit is contained in:
parent
e77c8157ae
commit
5389031d8c
4 changed files with 10 additions and 5 deletions
|
@ -1,5 +1,8 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## v0.4.5
|
||||||
|
- Ignore #nobot in bio if the user is also a member
|
||||||
|
|
||||||
## v0.4.4
|
## v0.4.4
|
||||||
- Fix some failing tests
|
- Fix some failing tests
|
||||||
- Lowercase the domain when normalizing an account
|
- Lowercase the domain when normalizing an account
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "fedigroups"
|
name = "fedigroups"
|
||||||
version = "0.4.4"
|
version = "0.4.5"
|
||||||
authors = ["Ondřej Hruška <ondra@ondrovo.com>"]
|
authors = ["Ondřej Hruška <ondra@ondrovo.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
|
@ -8,6 +8,8 @@ pub enum GroupError {
|
||||||
UserIsBanned,
|
UserIsBanned,
|
||||||
#[error("User opted out from the group")]
|
#[error("User opted out from the group")]
|
||||||
UserOptedOut,
|
UserOptedOut,
|
||||||
|
#[error("User opted out from the group using #nobot")]
|
||||||
|
UserOptedOutNobot,
|
||||||
#[error("Server could not be banned because there are admin users on it")]
|
#[error("Server could not be banned because there are admin users on it")]
|
||||||
AdminsOnServer,
|
AdminsOnServer,
|
||||||
#[error("Config error: {0}")]
|
#[error("Config error: {0}")]
|
||||||
|
|
|
@ -773,11 +773,11 @@ impl<'a> ProcessMention<'a> {
|
||||||
// Try to unfollow
|
// Try to unfollow
|
||||||
let account = self.client.get_account(id).await?;
|
let account = self.client.get_account(id).await?;
|
||||||
let bio = utils::strip_html(&account.note);
|
let bio = utils::strip_html(&account.note);
|
||||||
if RE_NOBOT_TAG.is_match(&bio) {
|
let normalized = normalize_acct(&account.acct, &self.group_acct)?;
|
||||||
// #nobot
|
if RE_NOBOT_TAG.is_match(&bio) && !self.config.is_member(&normalized) {
|
||||||
Err(GroupError::UserOptedOut)
|
// #nobot in a non-member account
|
||||||
|
Err(GroupError::UserOptedOutNobot)
|
||||||
} else {
|
} else {
|
||||||
let normalized = normalize_acct(&account.acct, &self.group_acct)?;
|
|
||||||
if self.config.is_banned(&normalized) {
|
if self.config.is_banned(&normalized) {
|
||||||
Err(GroupError::UserIsBanned)
|
Err(GroupError::UserIsBanned)
|
||||||
} else if self.config.is_optout(&normalized) {
|
} else if self.config.is_optout(&normalized) {
|
||||||
|
|
Loading…
Reference in a new issue