DEV: Convert delete-topic-disallowed modal to component-based API (#22830)

This commit is contained in:
Isaac Janzen 2023-07-27 15:08:37 -05:00 committed by GitHub
parent 173de8afe6
commit de6070fac4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 13 deletions

View File

@ -0,0 +1,8 @@
<DModal @closeModal={{@closeModal}}>
<:body>
<p>{{html-safe (i18n "post.controls.delete_topic_disallowed_modal")}}</p>
</:body>
<:footer>
<DButton @action={{@closeModal}} class="btn-primary" @label="close" />
</:footer>
</DModal>

View File

@ -24,7 +24,6 @@ const KNOWN_LEGACY_MODALS = [
"create-account", "create-account",
"create-invite-bulk", "create-invite-bulk",
"create-invite", "create-invite",
"delete-topic-disallowed",
"download-calendar", "download-calendar",
"edit-slow-mode", "edit-slow-mode",
"edit-topic-timer", "edit-topic-timer",

View File

@ -1,10 +0,0 @@
<DModalBody>
<p>{{html-safe (i18n "post.controls.delete_topic_disallowed_modal")}}</p>
</DModalBody>
<div class="modal-footer">
<DButton
@action={{route-action "closeModal"}}
@class="btn-primary"
@label="close"
/>
</div>

View File

@ -4,7 +4,6 @@ import discourseLater from "discourse-common/lib/later";
import { Promise } from "rsvp"; import { Promise } from "rsvp";
import { formattedReminderTime } from "discourse/lib/bookmark"; import { formattedReminderTime } from "discourse/lib/bookmark";
import { h } from "virtual-dom"; import { h } from "virtual-dom";
import showModal from "discourse/lib/show-modal";
import { smallUserAtts } from "discourse/widgets/actions-summary"; import { smallUserAtts } from "discourse/widgets/actions-summary";
import I18n from "I18n"; import I18n from "I18n";
import { import {
@ -12,6 +11,7 @@ import {
WITH_REMINDER_ICON, WITH_REMINDER_ICON,
} from "discourse/models/bookmark"; } from "discourse/models/bookmark";
import { isTesting } from "discourse-common/config/environment"; import { isTesting } from "discourse-common/config/environment";
import DeleteTopicDisallowedModal from "discourse/components/modal/delete-topic-disallowed";
const LIKE_ACTION = 2; const LIKE_ACTION = 2;
const VIBRATE_DURATION = 5; const VIBRATE_DURATION = 5;
@ -447,6 +447,7 @@ function replaceButton(buttons, find, replace) {
export default createWidget("post-menu", { export default createWidget("post-menu", {
tagName: "section.post-menu-area.clearfix", tagName: "section.post-menu-area.clearfix",
services: ["modal"],
settings: { settings: {
collapseButtons: true, collapseButtons: true,
@ -712,7 +713,7 @@ export default createWidget("post-menu", {
}, },
showDeleteTopicModal() { showDeleteTopicModal() {
showModal("delete-topic-disallowed"); this.modal.show(DeleteTopicDisallowedModal);
}, },
showMoreActions() { showMoreActions() {