forked from MightyPork/group-actor
fixes for new release
This commit is contained in:
+19
-22
@@ -250,27 +250,17 @@ impl GroupHandle {
|
||||
let ts = s.timestamp_millis();
|
||||
self.config.set_last_status(ts);
|
||||
|
||||
// Short circuit checks
|
||||
if s.visibility.is_private() {
|
||||
debug!("Status is direct/private, discard");
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if s.in_reply_to_id.is_some() {
|
||||
debug!("Status is a reply, discard");
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if !s.content.contains('#') {
|
||||
debug!("No tags in status, discard");
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let commands = crate::command::parse_slash_commands(&s.content);
|
||||
if commands.contains(&StatusCommand::Ignore) {
|
||||
debug!("Post has IGNORE command, discard");
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let group_user = self.config.get_acct();
|
||||
let status_user = normalize_acct(&s.account.acct, group_user)?;
|
||||
|
||||
@@ -279,25 +269,32 @@ impl GroupHandle {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if s.content.contains("/add ")
|
||||
|| s.content.contains("/remove ")
|
||||
|| s.content.contains("\\add ")
|
||||
|| s.content.contains("\\remove ")
|
||||
{
|
||||
debug!("Looks like a hashtag manipulation command, discard");
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if self.config.is_banned(&status_user) {
|
||||
debug!("Status author @{} is banned.", status_user);
|
||||
debug!("Status author @{} is banned, discard", status_user);
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if !self.config.is_member_or_admin(&status_user) {
|
||||
debug!("Status author @{} is not a member.", status_user);
|
||||
debug!("Status author @{} is not a member, discard", status_user);
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let commands = crate::command::parse_slash_commands(&s.content);
|
||||
if commands.contains(&StatusCommand::Ignore) {
|
||||
debug!("Post has IGNORE command, discard");
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
for m in s.mentions {
|
||||
let mentioned_user = normalize_acct(&m.acct, group_user)?;
|
||||
if mentioned_user == group_user {
|
||||
if !commands.is_empty() {
|
||||
debug!("Detected commands for this group, tags dont apply; discard");
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let tags = crate::command::parse_status_tags(&s.content);
|
||||
debug!("Tags in status: {:?}", tags);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user