mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	message_edit: Fix unmute of topic when topic name is edited.
Previously, when a topic was edited (including being resolved), it would become unmuted for any users who had muted it, which was annoying. While it's not possible to determine the user's intent completely, this is clearly incorrect behavior in the `change_all` case, such as resolving a topic. The comments discuss some scenarios where we might want to enhance this further, but this is the best we can do without large increases in complexity. Fixes #15210. Co-authored-by: akshatdalton <akshat.dak@students.iiit.ac.in>
This commit is contained in:
		@@ -1,6 +1,7 @@
 | 
			
		||||
import datetime
 | 
			
		||||
from typing import Any, Callable, Dict, List, Optional, Tuple
 | 
			
		||||
 | 
			
		||||
from django.db.models.query import QuerySet
 | 
			
		||||
from django.utils.timezone import now as timezone_now
 | 
			
		||||
from sqlalchemy.sql import ClauseElement, and_, column, not_, or_
 | 
			
		||||
from sqlalchemy.types import Integer
 | 
			
		||||
@@ -152,3 +153,13 @@ def build_topic_mute_checker(user_profile: UserProfile) -> Callable[[int, str],
 | 
			
		||||
        return (recipient_id, topic.lower()) in tups
 | 
			
		||||
 | 
			
		||||
    return is_muted
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def get_users_muting_topic(stream_id: int, topic_name: str) -> QuerySet[UserProfile]:
 | 
			
		||||
    return UserProfile.objects.select_related("realm").filter(
 | 
			
		||||
        id__in=UserTopic.objects.filter(
 | 
			
		||||
            stream_id=stream_id,
 | 
			
		||||
            visibility_policy=UserTopic.MUTED,
 | 
			
		||||
            topic_name__iexact=topic_name,
 | 
			
		||||
        ).values("user_profile_id")
 | 
			
		||||
    )
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user