mirror of
				https://github.com/zulip/zulip.git
				synced 2025-10-31 12:03:46 +00:00 
			
		
		
		
	settings: Add setting for marking resolved-topic notices as read.
This commit adds a new personal setting `resolved_topic_notice_auto_read_policy` which controls how resolved-topic notices are marked as read for a user. Fixes #33599.
This commit is contained in:
		
				
					committed by
					
						 Tim Abbott
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							3d33a05455
						
					
				
				
					commit
					70e45f45c0
				
			| @@ -1,4 +1,5 @@ | ||||
| from email.headerregistry import Address | ||||
| from enum import Enum | ||||
| from typing import TYPE_CHECKING, Any, Optional | ||||
| from uuid import uuid4 | ||||
|  | ||||
| @@ -35,6 +36,13 @@ if TYPE_CHECKING: | ||||
|     from zerver.models import Realm | ||||
|  | ||||
|  | ||||
| class ResolvedTopicNoticeAutoReadPolicyEnum(Enum): | ||||
|     # The case is used by Pydantic in the API | ||||
|     always = 1 | ||||
|     except_followed = 2 | ||||
|     never = 3 | ||||
|  | ||||
|  | ||||
| class UserBaseSettings(models.Model): | ||||
|     """This abstract class is the container for all preferences/personal | ||||
|     settings for users that control the behavior of the application. | ||||
| @@ -263,6 +271,12 @@ class UserBaseSettings(models.Model): | ||||
|     ) | ||||
|     automatically_follow_topics_where_mentioned = models.BooleanField(default=True) | ||||
|  | ||||
|     resolved_topic_notice_auto_read_policy = models.PositiveSmallIntegerField( | ||||
|         default=ResolvedTopicNoticeAutoReadPolicyEnum.except_followed.value, | ||||
|         db_default=ResolvedTopicNoticeAutoReadPolicyEnum.except_followed.value, | ||||
|     ) | ||||
|     RESOLVED_TOPIC_NOTICE_AUTO_READ_POLICY_TYPES = list(ResolvedTopicNoticeAutoReadPolicyEnum) | ||||
|  | ||||
|     # Whether or not the user wants to sync their drafts. | ||||
|     enable_drafts_synchronization = models.BooleanField(default=True) | ||||
|  | ||||
| @@ -364,6 +378,7 @@ class UserBaseSettings(models.Model): | ||||
|         web_navigate_to_sent_message=bool, | ||||
|         web_suggest_update_timezone=bool, | ||||
|         hide_ai_features=bool, | ||||
|         resolved_topic_notice_auto_read_policy=ResolvedTopicNoticeAutoReadPolicyEnum, | ||||
|     ) | ||||
|  | ||||
|     modern_notification_settings = dict( | ||||
|   | ||||
		Reference in New Issue
	
	Block a user