mirror of https://github.com/zulip/zulip.git
feedback_widget: Allow undo opts to be undefined.
There's existing logic that assumes `on_undo` can be `undefined`. (see the `opts.on_undo === undefined` if clause) This commit updates some types to let it actually be `undefined`, which it is in `message_edit`, which we're about to convert to typescript.
This commit is contained in:
parent
b2400496fd
commit
d5eb997242
|
@ -28,14 +28,14 @@ type FeedbackWidgetMeta = {
|
|||
$container: JQuery | null;
|
||||
opened: boolean;
|
||||
handlers_set?: boolean;
|
||||
undo?: () => void;
|
||||
undo: (() => void) | undefined;
|
||||
};
|
||||
|
||||
type FeedbackWidgetOptions = {
|
||||
populate: (element: JQuery) => void;
|
||||
title_text: string;
|
||||
undo_button_text: string;
|
||||
on_undo: () => void;
|
||||
undo_button_text?: string;
|
||||
on_undo?: () => void;
|
||||
};
|
||||
|
||||
const meta: FeedbackWidgetMeta = {
|
||||
|
@ -43,6 +43,7 @@ const meta: FeedbackWidgetMeta = {
|
|||
alert_hover_state: false,
|
||||
$container: null,
|
||||
opened: false,
|
||||
undo: undefined,
|
||||
};
|
||||
|
||||
const animate = {
|
||||
|
@ -171,7 +172,7 @@ export function show(opts: FeedbackWidgetOptions): void {
|
|||
meta.hide_me_time = Date.now() + 4000;
|
||||
|
||||
meta.$container.find(".feedback_title").text(opts.title_text);
|
||||
meta.$container.find(".feedback_undo").text(opts.undo_button_text);
|
||||
meta.$container.find(".feedback_undo").text(opts.undo_button_text ?? "");
|
||||
opts.populate(meta.$container.find(".feedback_content"));
|
||||
|
||||
animate.fadeIn();
|
||||
|
|
Loading…
Reference in New Issue