Use topic_name() helper in more places.

This commit is contained in:
Steve Howell 2018-11-01 15:18:20 +00:00 committed by Tim Abbott
parent 55afadc286
commit 2fd0cfe708
5 changed files with 6 additions and 6 deletions

View File

@ -4021,7 +4021,7 @@ def do_delete_message(user_profile: UserProfile, message: Message) -> None:
'message_type': message_type, } # type: Dict[str, Any]
if message_type == "stream":
event['stream_id'] = message.recipient.type_id
event['topic'] = message.subject
event['topic'] = message.topic_name()
else:
event['recipient_user_ids'] = message.recipient.type_id

View File

@ -96,7 +96,7 @@ def gather_hot_conversations(user_profile: UserProfile, stream_messages: QuerySe
continue
key = (user_message.message.recipient.type_id,
user_message.message.subject)
user_message.message.topic_name())
conversation_diversity[key].add(
user_message.message.sender.full_name)
conversation_length[key] += 1

View File

@ -104,7 +104,7 @@ def create_missed_message_address(user_profile: UserProfile, message: Message) -
data = {
'user_profile_id': user_profile.id,
'recipient_id': recipient_id,
'subject': message.subject.encode('utf-8'),
'subject': message.topic_name().encode('utf-8'),
}
while True:

View File

@ -192,9 +192,9 @@ def build_message_list(user_profile: UserProfile, messages: List[Message]) -> Li
stream = Stream.objects.only('id', 'name').get(id=message.recipient.type_id)
header = "%s > %s" % (stream.name, message.topic_name())
stream_link = stream_narrow_url(user_profile.realm, stream)
topic_link = topic_narrow_url(user_profile.realm, stream, message.subject)
topic_link = topic_narrow_url(user_profile.realm, stream, message.topic_name())
header_html = "<a href='%s'>%s</a> > <a href='%s'>%s</a>" % (
stream_link, stream.name, topic_link, message.subject)
stream_link, stream.name, topic_link, message.topic_name())
return {"plain": header,
"html": header_html,
"stream_message": message.recipient.type_name() == "stream"}

View File

@ -1277,7 +1277,7 @@ def fill_edit_history_entries(message_history: List[Dict[str, Any]], message: Me
"""
prev_content = message.content
prev_rendered_content = message.rendered_content
prev_topic = message.subject
prev_topic = message.topic_name()
# Make sure that the latest entry in the history corresponds to the
# message's last edit time