mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 00:46:03 +00:00
settings_streams: Fix error thrown when adding 'default-channels'.
The 'Select channel' dropdown in 'Add default channels' modal is
the LAST dropdown element on the modal and it does not contain
`data-stream-id` attribute.
.attr('data-stream-id') would return undefined for this element
and as a result the returned `Set` would have its last element a
`NaN` --- passing a `NaN` inside 'data' field of 'channel.post' threw
an error.
We tweaked the selector string to selectively map over the elements with
'data-stream-id' attribute.
Also we removed '.toString()' converting stream-id to a string (stream-id is a
'number' type).
This commit is contained in:
@@ -296,12 +296,12 @@ export function delete_sub(stream_id: number): void {
|
||||
stream_info.delete(stream_id);
|
||||
}
|
||||
|
||||
export function get_non_default_stream_names(): {name: string; unique_id: string}[] {
|
||||
export function get_non_default_stream_names(): {name: string; unique_id: number}[] {
|
||||
let subs = [...stream_info.values()];
|
||||
subs = subs.filter((sub) => !is_default_stream_id(sub.stream_id) && !sub.invite_only);
|
||||
const names = subs.map((sub) => ({
|
||||
name: sub.name,
|
||||
unique_id: sub.stream_id.toString(),
|
||||
unique_id: sub.stream_id,
|
||||
}));
|
||||
return names;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user