mirror of https://github.com/zulip/zulip.git
unread_ops: Convert stream ids to integers before sending request to server.
This bug was introduced in #31299, which replaced the channel name with a string id. It's still valid to send the channel id to the server, but it shouldn't be a string, it should be a number. (See https://zulip.com/api/construct-narrow#channel-and-user-ids) In the future, we hope to update NarrowTerm to allow for integer operands for channel terms.
This commit is contained in:
parent
57c39fc257
commit
52440c1cff
|
@ -89,6 +89,15 @@ function bulk_update_read_flags_for_narrow(
|
||||||
caller_modal_id?: string,
|
caller_modal_id?: string,
|
||||||
): void {
|
): void {
|
||||||
let response_html;
|
let response_html;
|
||||||
|
const terms_with_integer_channel_id = narrow.map((term) => {
|
||||||
|
if (term.operator === "channel") {
|
||||||
|
return {
|
||||||
|
...term,
|
||||||
|
operand: Number.parseInt(term.operand, 10),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return term;
|
||||||
|
});
|
||||||
const request = {
|
const request = {
|
||||||
anchor,
|
anchor,
|
||||||
// anchor="oldest" is an anchor ID lower than any valid
|
// anchor="oldest" is an anchor ID lower than any valid
|
||||||
|
@ -100,7 +109,7 @@ function bulk_update_read_flags_for_narrow(
|
||||||
num_after,
|
num_after,
|
||||||
op,
|
op,
|
||||||
flag: "read",
|
flag: "read",
|
||||||
narrow: JSON.stringify(narrow),
|
narrow: JSON.stringify(terms_with_integer_channel_id),
|
||||||
};
|
};
|
||||||
void channel.post({
|
void channel.post({
|
||||||
url: "/json/messages/flags/narrow",
|
url: "/json/messages/flags/narrow",
|
||||||
|
|
Loading…
Reference in New Issue