delete_topic: Delete UserTopic rows when a topic is deleted.

Earlier, when a topic was deleted then UserTopic rows corresponding
to that topic were not deleted resulting in a bug where the topic
is listed in the '/#settings/topics' panel even after deletion.

This commit fixes the incorrect behavior to delete the concerned
UserTopic rows.

We need to take special care of the case when a topic is deleted
in private channel with protected history. We delete the UserTopic
records for exactly the users for whom after the topic deletion
action, they no longer have access to any messages in the topic.
This commit is contained in:
Prakhar Pratyush
2024-08-27 12:46:46 +05:30
committed by Tim Abbott
parent d0730131a2
commit 31b3842c9b
3 changed files with 67 additions and 3 deletions

View File

@@ -246,6 +246,7 @@ python_rules = RuleList(
"exclude": FILES_WITH_LEGACY_SUBJECT,
"exclude_line": {
("zerver/lib/message.py", "message__subject__iexact=message.topic_name(),"),
("zerver/views/streams.py", "message__subject__iexact=topic_name,"),
},
"include_only": {
"zerver/data_import/",