zulip
zulip copied to clipboard
resolve topic: Add resolve topic undo grace period.
Currently we send a notification to the topic if it has been resolved or unresolved even if there is an immediate event of resolving and then unresolving or vice-versa. This adds a setting of RESOLVE_TOPIC_UNDO_GRACE_PERIOD_SECONDS under which if a topic has been unresolved after being resolved immediately and the last message was the notification of resolving, then delete the last message and don't send a new notification and vice-versa.
Fixes #19181.
Testing plan:
GIFs or screenshots:
This is great, but the test for whether the previous message was one of these "marked topic as resolved" notifications is pretty hacky. I think we want to address that my adding a message type field of some sort; I'm going to propose a design for that, but this is probably on hold until we work that out.
I added a minimal set of commits to create a message_type field and use that for this feature.
I don't think the last two commits are ready to merge; the message_type plumbing one just because it's incompletely and probably deserves an s/message_type/recipient_type refactor on the backend codebase before it is added. And the second because I'm not sure what ID we want to use or whether we want to have separate types for the resolve/unresolve notifications.
Is it fine if I update the last commit to pass the CI?
Yeah, please do!
Heads up @ligmitz, we just merged some commits that conflict with the changes your made in this pull request! You can review this repository's recent commits to see where the conflicts occur. Please rebase your feature branch against the upstream/main branch and resolve your pull request's merge conflicts accordingly.
Closing in favor of https://github.com/zulip/zulip/pull/30307 which finishes this up. Thanks for doing the main part of this logic @ligmitz!