mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
inbox_ui: Remove extra effort to return message object.
There is no difference in this case when a message object is returned vs not. So, we just return as soon as we have the requried data. This will useful when won't have message ids associated with topic easily when rendering inbox style channel view.
This commit is contained in:
@@ -949,24 +949,22 @@ export function get_focused_row_message(): {message?: Message | undefined} & (
|
||||
return {message};
|
||||
}
|
||||
|
||||
const $stream = $focused_row.parent(".inbox-topic-container").parent();
|
||||
const stream_key = $stream.attr("id");
|
||||
assert(stream_key !== undefined);
|
||||
const row_info = topics_dict.get(stream_key)!.get(conversation_key);
|
||||
assert(row_info !== undefined);
|
||||
const message = message_store.get(row_info.latest_msg_id);
|
||||
// Last case: focused on a topic row.
|
||||
// Since inbox is populated based on unread data which is part
|
||||
// of /register request, it is possible that we don't have the
|
||||
// actual message in our message_store. In that case, we return
|
||||
// a fake message object.
|
||||
if (message === undefined) {
|
||||
return {
|
||||
msg_type: "stream",
|
||||
stream_id: row_info.stream_id,
|
||||
topic: row_info.topic_name,
|
||||
};
|
||||
}
|
||||
return {message};
|
||||
const $topic_menu_elt = $focused_row.find(".inbox-topic-menu");
|
||||
const topic = $topic_menu_elt.attr("data-topic-name");
|
||||
assert(topic !== undefined);
|
||||
const stream_id = Number($topic_menu_elt.attr("data-stream-id"));
|
||||
assert(stream_id !== undefined);
|
||||
|
||||
return {
|
||||
msg_type: "stream",
|
||||
stream_id,
|
||||
topic,
|
||||
};
|
||||
}
|
||||
|
||||
export function toggle_topic_visibility_policy(): boolean {
|
||||
|
||||
Reference in New Issue
Block a user