mirror of
https://github.com/discourse/discourse.git
synced 2024-12-02 10:43:45 +08:00
bd7823cc70
The bug was due to the fact that the `<DModal />` is displayed inside a if block, when the condition was false to close the menu, the modal was just hidden without calling callbacks. The fix ensures we are correctly calling `modal.close()` before in this case.
30 lines
651 B
JavaScript
30 lines
651 B
JavaScript
import { setOwner } from "@ember/application";
|
|
import { action } from "@ember/object";
|
|
import { service } from "@ember/service";
|
|
import uniqueId from "discourse/helpers/unique-id";
|
|
import { TOAST } from "float-kit/lib/constants";
|
|
|
|
export default class DToastInstance {
|
|
@service site;
|
|
@service toasts;
|
|
|
|
options = null;
|
|
id = uniqueId();
|
|
|
|
constructor(owner, options = {}) {
|
|
setOwner(this, owner);
|
|
this.options = { ...TOAST.options, ...options };
|
|
}
|
|
|
|
@action
|
|
close() {
|
|
this.toasts.close(this);
|
|
}
|
|
|
|
get isValidForView() {
|
|
return this.options.views.includes(
|
|
this.site.desktopView ? "desktop" : "mobile"
|
|
);
|
|
}
|
|
}
|