mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 20:44:04 +00:00
ui_report: Correctly check if remove_after is passed.
We use a simpler approach here which is to let it be undefined if nothing was passed and use that in the if condition. This has two benefits. There is no edge case where the condition will evaluate to false if 0 was passed and it is easier to type annotate.
This commit is contained in:
committed by
Tim Abbott
parent
5ae523891b
commit
9e08c6db93
@@ -10,7 +10,7 @@ import {$t} from "./i18n";
|
||||
cls- class that we want to add/remove to/from the status_box
|
||||
*/
|
||||
|
||||
export function message(response_html, status_box, cls = "alert", remove_after = false) {
|
||||
export function message(response_html, status_box, cls = "alert", remove_after) {
|
||||
// Note we use html() below, since we can rely on our callers escaping HTML
|
||||
// via $t_html when interpolating data.
|
||||
status_box
|
||||
@@ -19,7 +19,7 @@ export function message(response_html, status_box, cls = "alert", remove_after =
|
||||
.html(response_html)
|
||||
.stop(true)
|
||||
.fadeTo(0, 1);
|
||||
if (remove_after) {
|
||||
if (remove_after !== undefined) {
|
||||
setTimeout(() => {
|
||||
status_box.fadeOut(400);
|
||||
}, remove_after);
|
||||
|
||||
Reference in New Issue
Block a user