From 2671de3f86844d970b1c7a0e1747f7c4e2099a3c Mon Sep 17 00:00:00 2001
From: Isaac Janzen <50783505+janzenisaac@users.noreply.github.com>
Date: Tue, 29 Aug 2023 11:09:57 -0500
Subject: [PATCH] DEV: Convert `post-enqueued` modal to component-based API
(#23295)
---
.../app/components/modal/post-enqueued.hbs | 21 +++++++++++++++++++
.../discourse/app/services/composer.js | 7 ++-----
.../discourse/app/services/modal.js | 1 -
.../app/templates/modal/post-enqueued.hbs | 14 -------------
4 files changed, 23 insertions(+), 20 deletions(-)
create mode 100644 app/assets/javascripts/discourse/app/components/modal/post-enqueued.hbs
delete mode 100644 app/assets/javascripts/discourse/app/templates/modal/post-enqueued.hbs
diff --git a/app/assets/javascripts/discourse/app/components/modal/post-enqueued.hbs b/app/assets/javascripts/discourse/app/components/modal/post-enqueued.hbs
new file mode 100644
index 00000000000..991d60d93c1
--- /dev/null
+++ b/app/assets/javascripts/discourse/app/components/modal/post-enqueued.hbs
@@ -0,0 +1,21 @@
+
+ <:body>
+ {{i18n "review.approval.description"}}
+
+ {{html-safe
+ (i18n "review.approval.pending_posts" count=@model.pending_count)
+ }}
+
+
+ <:footer>
+
+
+
\ No newline at end of file
diff --git a/app/assets/javascripts/discourse/app/services/composer.js b/app/assets/javascripts/discourse/app/services/composer.js
index 1bf79699aa4..3db88f19cad 100644
--- a/app/assets/javascripts/discourse/app/services/composer.js
+++ b/app/assets/javascripts/discourse/app/services/composer.js
@@ -32,13 +32,13 @@ import { isEmpty } from "@ember/utils";
import { isTesting } from "discourse-common/config/environment";
import Service, { inject as service } from "@ember/service";
import { shortDate } from "discourse/lib/formatter";
-import showModal from "discourse/lib/show-modal";
import { categoryBadgeHTML } from "discourse/helpers/category-link";
import renderTags from "discourse/lib/render-tags";
import { htmlSafe } from "@ember/template";
import { iconHTML } from "discourse-common/lib/icon-library";
import prepareFormTemplateData from "discourse/lib/form-template-validation";
import DiscardDraftModal from "discourse/components/modal/discard-draft";
+import PostEnqueuedModal from "discourse/components/modal/post-enqueued";
async function loadDraft(store, opts = {}) {
let { draft, draftKey, draftSequence } = opts;
@@ -1169,10 +1169,7 @@ export default class ComposerService extends Service {
@action
postWasEnqueued(details) {
- showModal("post-enqueued", {
- model: details,
- title: "review.approval.title",
- });
+ this.modal.show(PostEnqueuedModal, { model: details });
}
// Notify the composer messages controller that a reply has been typed. Some
diff --git a/app/assets/javascripts/discourse/app/services/modal.js b/app/assets/javascripts/discourse/app/services/modal.js
index c817cbe923b..83160432aa5 100644
--- a/app/assets/javascripts/discourse/app/services/modal.js
+++ b/app/assets/javascripts/discourse/app/services/modal.js
@@ -22,7 +22,6 @@ const KNOWN_LEGACY_MODALS = [
"group-default-notifications",
"login",
"move-to-topic",
- "post-enqueued",
"raw-email",
"reject-reason-reviewable",
"reorder-categories",
diff --git a/app/assets/javascripts/discourse/app/templates/modal/post-enqueued.hbs b/app/assets/javascripts/discourse/app/templates/modal/post-enqueued.hbs
deleted file mode 100644
index 701b4668256..00000000000
--- a/app/assets/javascripts/discourse/app/templates/modal/post-enqueued.hbs
+++ /dev/null
@@ -1,14 +0,0 @@
-
- {{i18n "review.approval.description"}}
-
- {{html-safe
- (i18n "review.approval.pending_posts" count=this.model.pending_count)
- }}
-
-
\ No newline at end of file