Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automod "action" messages cause subresub messages to be disabled #5589

Closed
4 tasks done
jupjohn opened this issue Sep 10, 2024 · 7 comments · Fixed by #5611
Closed
4 tasks done

Automod "action" messages cause subresub messages to be disabled #5589

jupjohn opened this issue Sep 10, 2024 · 7 comments · Fixed by #5611
Labels
bug Something isn't working as intended, or works in a confusing/unintuitive way for the user

Comments

@jupjohn
Copy link
Contributor

jupjohn commented Sep 10, 2024

Checklist

  • I'm reporting a problem with Chatterino
  • I've verified that I'm running the most recent nightly build or stable release
  • I've looked for my problem on the wiki
  • I've searched the issues and pull requests for similar looking reports

Describe your issue

When an automod action message is received, the last laid out non-PRIVMSG message will be disabled (greyed out)

Screenshots

image

OS and Chatterino Version

Chatterino 2.5.1 DEBUG (commit 2afa227 modified) built with Qt 5.15.15 Running on Arch Linux, kernel: 6.10.8-zen1-1-zen

@jupjohn jupjohn added the issue-report An issue reported by a user. label Sep 10, 2024
@jupjohn
Copy link
Contributor Author

jupjohn commented Sep 10, 2024

This deletion behaviour was originally implemented in #1012. I suspect it was to "delete" (disable) the newly added automod message, but those messages have a defaulted empty message ID so the internal findMessage call just finds the last message that didn't have a message ID. That could be anything from another automod message, an emote add event, or a resub to name a few.

The two solutions I see here are:

  1. If this was intended to delete the new message (which makes sense because of what message ID it's trying to pass), the deleteMessage call can be moved into the postToThread callback (tested & works). Would probably want to give these messages proper IDs (something like chatterino-<guid>) to prevent weird empty ID issues like this
  2. If we don't care about deleting these messages (leaving them as normal system messages), might as well just drop the delete call

@iProdigy
Copy link
Contributor

for option 1, we can rely on the term id present in the pubsub payload

@pajlada pajlada added bug Something isn't working as intended, or works in a confusing/unintuitive way for the user and removed issue-report An issue reported by a user. labels Sep 30, 2024
@Nerixyz
Copy link
Contributor

Nerixyz commented Sep 30, 2024

I suspect it was to "delete" (disable) the newly added automod message

In my opinion, we shouldn't try to delete any message there (option 2). We don't delete any other automod messages either.

@pajlada
Copy link
Member

pajlada commented Sep 30, 2024

The idea behind the feature is to delete "Block"/"Delete" message iirc
A message comes in to all moderators, and they're given the choice to allow the message or to disallow the message.
If you or another moderator picks allow or disallow, the message prompting you to action should be grayed out.

@jupjohn
Copy link
Contributor Author

jupjohn commented Oct 1, 2024

Thanks guys,

If the original reason was to just disable the auto mod action messages, I'm happy to make the code match.

@jupjohn
Copy link
Contributor Author

jupjohn commented Oct 1, 2024

Slight issue with using the ID from the PubSub messages: the add_permitted_term message contains a different AutoMod message ID than the pending message. It does come through on the allowed message, but we don't handle that message from PubSub.

Given that PubSub is on the way out, I'd say it's not worth fixing this until AutoMod messages are ported to EventSub (which looks to have 100% parity to my untrained eye.) I'll spend tonight figuring out how EventSub works in c2 and see if it's something I feel like putting time into - otherwise this can be shelved until a danker gets around to EventSub.

Example:

[
    {
        "type": "MESSAGE",
        "data": {
            "topic": "automod-queue.82674227.82674227",
            "message": "{\"type\":\"automod_caught_message\",\"data\":{\"id\":\"2fbf6ea3-26cc-4358-a57b-3b606822ac5a\",\"content_classification\":{\"category\":\"swearing\",\"level\":4},\"message\":{\"content\":{\"text\":\"bugger\",\"fragments\":[{\"text\":\"bugger\",\"automod\":{\"topics\":{\"vulgar\":3}}}]},\"id\":\"2fbf6ea3-26cc-4358-a57b-3b606822ac5a\",\"channel_id\":\"82674227\",\"channel_login\":\"jammehge\",\"sender\":{\"user_id\":\"726078183\",\"login\":\"jammeheg\",\"display_name\":\"jammeheg\",\"chat_color\":\"#8A2BE2\"},\"sent_at\":\"2024-10-01T06:40:00.183214834Z\"},\"reason_code\":\"AutoModCaughtMessageReason\",\"resolver_id\":\"\",\"resolver_login\":\"\",\"status\":\"PENDING\",\"caught_message_reason\":{\"reason\":\"AutoModCaughtMessageReason\",\"automod_failure\":{\"category\":\"swearing\",\"level\":4,\"positions_in_message\":[{\"start_pos\":0,\"end_pos\":5}]},\"blocked_term_failure\":{\"contains_private_term\":false,\"terms_found\":null}}}}"
        }
    },
    {
        "type": "MESSAGE",
        "data": {
            "topic": "automod-queue.82674227.82674227",
            "message": "{\"type\":\"automod_caught_message\",\"data\":{\"id\":\"2fbf6ea3-26cc-4358-a57b-3b606822ac5a\",\"content_classification\":{\"category\":\"swearing\",\"level\":4},\"message\":{\"content\":{\"text\":\"bugger\",\"fragments\":[{\"text\":\"bugger\",\"automod\":{\"topics\":{\"vulgar\":3}}}]},\"id\":\"2fbf6ea3-26cc-4358-a57b-3b606822ac5a\",\"channel_id\":\"82674227\",\"channel_login\":\"jammehge\",\"sender\":{\"user_id\":\"726078183\",\"login\":\"jammeheg\",\"display_name\":\"jammeheg\",\"chat_color\":\"#8A2BE2\"},\"sent_at\":\"2024-10-01T06:40:00.183214834Z\"},\"reason_code\":\"\",\"resolver_id\":\"82674227\",\"resolver_login\":\"jammehge\",\"status\":\"ALLOWED\",\"caught_message_reason\":{\"reason\":\"AutoModCaughtMessageReason\",\"automod_failure\":{\"category\":\"swearing\",\"level\":4,\"positions_in_message\":[{\"start_pos\":0,\"end_pos\":5}]},\"blocked_term_failure\":{\"contains_private_term\":false,\"terms_found\":null}}}}"
        }
    },
    {
        "type": "MESSAGE",
        "data": {
            "topic": "chat_moderator_actions.82674227.82674227",
            "message": "{\"type\":\"channel_terms_action\",\"data\":{\"type\":\"add_permitted_term\",\"id\":\"d44b3c6b-4aec-4ebf-a029-bd93165a4e9c\",\"text\":\"bugger\",\"requester_id\":\"82674227\",\"requester_login\":\"jammehge\",\"channel_id\":\"82674227\",\"expires_at\":\"2024-10-01T07:40:58.393080886Z\",\"updated_at\":\"2024-10-01T06:40:58.393080128Z\",\"from_automod\":true}}"
        }
    }
]

@iProdigy
Copy link
Contributor

iProdigy commented Oct 1, 2024

See #4962 for eventsub - I can take a stab at adding those pubsub branches if you'd like

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as intended, or works in a confusing/unintuitive way for the user
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants