messages: Use stream_id instead of stream name.

This should cause no functional changes.

This is part of a multi-step effort to move away
from using stream names to reference streams, now
that it's impossible for a user to write a message
with an invalid stream name (since switching to
the dropdown).
This commit is contained in:
evykassirer
2023-07-26 13:07:21 -07:00
committed by Tim Abbott
parent 45af8a9406
commit 846b470b99
31 changed files with 154 additions and 108 deletions

View File

@@ -418,7 +418,7 @@ export class MessageListView {
message_container.sender_is_guest = people.sender_is_guest(message_container.msg);
message_container.small_avatar_url = people.small_avatar_url(message_container.msg);
if (message_container.msg.stream) {
if (message_container.msg.stream_id) {
message_container.background_color = stream_data.get_color(
message_container.msg.stream_id,
);
@@ -447,19 +447,20 @@ export class MessageListView {
const last_subscribed = !last_msg_container.msg.historical;
const first_subscribed = !first_msg_container.msg.historical;
const stream = first_msg_container.msg.stream;
const stream_id = first_msg_container.msg.stream_id;
const stream_name = stream_data.get_stream_name_from_id(stream_id);
if (!last_subscribed && first_subscribed) {
group.bookend_top = true;
group.subscribed = true;
group.stream_name = stream;
group.stream_name = stream_name;
return;
}
if (last_subscribed && !first_subscribed) {
group.bookend_top = true;
group.just_unsubscribed = true;
group.stream_name = stream;
group.stream_name = stream_name;
return;
}
}
@@ -517,7 +518,7 @@ export class MessageListView {
this.maybe_add_subscription_marker(current_group, prev, message_container);
if (message_container.msg.stream) {
if (message_container.msg.stream_id) {
message_container.stream_url = hash_util.by_stream_url(
message_container.msg.stream_id,
);