Skip to content

policyeval/eventhandle: Add menu to write room un/bans to policy lists#47

Open
nexy7574 wants to merge 3 commits intomainfrom
nexy7574/propagation-prompt
Open

policyeval/eventhandle: Add menu to write room un/bans to policy lists#47
nexy7574 wants to merge 3 commits intomainfrom
nexy7574/propagation-prompt

Conversation

@nexy7574
Copy link
Collaborator

@nexy7574 nexy7574 commented Dec 20, 2025

Sometimes it's faster to ban a problematic user in a room, and then add them to the policy list when you catch a second. This PR makes it easier to do that follow-up step by presenting relevant management rooms with a notice and prompt menu.

If the user was previously not banned, and is now banned, the bot will notify management rooms of who was banned, where, who by, and why, and prompts them to copy that ban to any policy lists that are watched and the bot has write access to.

If the user was previously banned, and is now unbanned, the bot will find all matching policies, filter for ones it can remove, provide a similar notification to above, and instead prompts them to remove any of the given policies, provided the bot is capable of removing them (i.e. again, has write access to the relevant list).

2025-12-20_02-44-01.mp4

This is similar in functionality to Draupnir's BanPropagationProtection

Copy link
Collaborator Author

@nexy7574 nexy7574 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few UX woes to weed out before merge

Stringer("user_id", userID).
Stringer("room_id", evt.RoomID).
Msg("Prompting ban propagation")
pe.propagateBan(ctx, evt)
Copy link
Collaborator Author

@nexy7574 nexy7574 Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Being banned in several rooms can trigger this prompt multiple times, should it be deduplicated?
  • The ban being undone does not short-circuit the menu which can be annoying
  • Should the user be able to ban to multiple lists from one prompt (via multi-use)?
if checkRules {
pe.EvaluateUser(ctx, userID, false)
}
if evt.Unsigned.PrevContent != nil && evt.Sender != pe.Bot.UserID {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should probably be an option to disable these prompts altogether (since a bot might be configured to be read-only, for example). This should probably be configurable per-bot though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant