mirror of https://github.com/zulip/zulip.git
Extract filter_by_topic_name_via_message.
This commit is contained in:
parent
2fd0cfe708
commit
7252861785
|
@ -57,6 +57,7 @@ from zerver.lib.stream_subscription import (
|
|||
from zerver.lib.stream_topic import StreamTopicTarget
|
||||
from zerver.lib.topic import (
|
||||
filter_by_exact_message_topic,
|
||||
filter_by_topic_name_via_message,
|
||||
)
|
||||
from zerver.lib.topic_mutes import (
|
||||
get_topic_mutes,
|
||||
|
@ -3652,7 +3653,10 @@ def do_mark_stream_messages_as_read(user_profile: UserProfile,
|
|||
msgs = msgs.filter(message__recipient=recipient)
|
||||
|
||||
if topic_name:
|
||||
msgs = msgs.filter(message__subject__iexact=topic_name)
|
||||
msgs = filter_by_topic_name_via_message(
|
||||
query=msgs,
|
||||
topic_name=topic_name,
|
||||
)
|
||||
|
||||
msgs = msgs.extra(
|
||||
where=[UserMessage.where_unread()]
|
||||
|
|
|
@ -13,6 +13,9 @@ def filter_by_exact_message_topic(query: QuerySet, message: Message) -> QuerySet
|
|||
topic_name = message.topic_name()
|
||||
return query.filter(subject=topic_name)
|
||||
|
||||
def filter_by_topic_name_via_message(query: QuerySet, topic_name: str) -> QuerySet:
|
||||
return query.filter(message__subject__iexact=topic_name)
|
||||
|
||||
def generate_topic_history_from_db_rows(rows: List[Tuple[str, int]]) -> List[Dict[str, Any]]:
|
||||
canonical_topic_names = {} # type: Dict[str, Tuple[int, str]]
|
||||
|
||||
|
|
Loading…
Reference in New Issue