can_post_messages_in_stream: Add condition check for archived streams.

Prevents users from sending any message in an archived stream.
This commit is contained in:
sanchi-t 2024-03-01 12:14:18 +05:30 committed by Tim Abbott
parent 7e97358c35
commit 4b90741f91
2 changed files with 7 additions and 0 deletions

View File

@ -568,6 +568,10 @@ export function can_unsubscribe_others(sub: StreamSubscription): boolean {
}
export function can_post_messages_in_stream(stream: StreamSubscription): boolean {
if (stream.is_archived) {
return false;
}
if (page_params.is_spectator) {
return false;
}

View File

@ -1116,6 +1116,9 @@ test("can_post_messages_in_stream", ({override}) => {
page_params.is_spectator = true;
assert.equal(stream_data.can_post_messages_in_stream(social), false);
social.is_archived = true;
assert.equal(stream_data.can_post_messages_in_stream(social), false);
});
test("can_unsubscribe_others", ({override}) => {