mirror of
https://github.com/zulip/zulip.git
synced 2025-11-15 03:11:54 +00:00
widgets: Always render and activate widgets in the current view.
Earlier we did not activate widgets if their rendered HTML was cached, and also when narrowing to the combined feed view. This caused bugs with widgets not being activated, and so not responding to any interactions. Now we unconditionally render and activate widgets in the current view, irrespective of the cached HTML or the view being narrowed to.
This commit is contained in:
@@ -2,6 +2,7 @@ import {z} from "zod";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as channel from "./channel";
|
||||
import type {MessageList} from "./message_lists";
|
||||
import * as message_store from "./message_store";
|
||||
import type {Message} from "./message_store";
|
||||
import type {Submessage} from "./types";
|
||||
@@ -87,6 +88,14 @@ export function get_message_events(message: Message): SubmessageEvents | undefin
|
||||
return clean_events;
|
||||
}
|
||||
|
||||
export function process_widget_rows_in_list(list: MessageList | undefined): void {
|
||||
for (const message_id of widgetize.widget_contents.keys()) {
|
||||
if (list?.get(message_id) !== undefined) {
|
||||
process_submessages({message_id, $row: list.get_row(message_id)});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function process_submessages(in_opts: {$row: JQuery; message_id: number}): void {
|
||||
// This happens in our rendering path, so we try to limit any
|
||||
// damage that may be triggered by one rogue message.
|
||||
|
||||
Reference in New Issue
Block a user