fixes for new release

This commit is contained in:
2021-08-28 10:24:35 +02:00
parent 31a9d767ae
commit c52147ad4d
8 changed files with 128 additions and 66 deletions
+19 -22
View File
@@ -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);