A platform for community discussion. Free, open, simple.
DEV: Remove `optionalRequire` of admin module (#41281)
David Taylorbf6006845549
diff --git a/frontend/discourse/app/controllers/tags/index.js b/frontend/discourse/app/controllers/tags/index.jsindex 530064e8e7c..d1fec3104b2 100644--- a/frontend/discourse/app/controllers/tags/index.js+++ b/frontend/discourse/app/controllers/tags/index.js@@ -5,7 +5,6 @@ import { service } from "@ember/service";import { isEmpty } from "@ember/utils";import { ajax } from "discourse/lib/ajax";import { popupAjaxError } from "discourse/lib/ajax-error";-import { optionalRequire } from "discourse/lib/utilities";export default class TagsIndexController extends Controller {@service router;@@ -57,10 +56,6 @@ export default class TagsIndexController extends Controller {return !isEmpty(this.model?.extras?.tag_groups);}- get TagsAdminDropdownComponent() {- return optionalRequire("discourse/admin/components/tags-admin-dropdown");- }-get canCreateTags() {return this.bulkTagInput && this.bulkTagInput.trim().length > 0;}diff --git a/frontend/discourse/app/templates/tags/index.gjs b/frontend/discourse/app/templates/tags/index.gjsindex 716d65ffea3..b2ba10b2b80 100644--- a/frontend/discourse/app/templates/tags/index.gjs+++ b/frontend/discourse/app/templates/tags/index.gjs@@ -6,11 +6,17 @@ import TagList from "discourse/components/tag-list";import lazyHash from "discourse/helpers/lazy-hash";import withEventValue from "discourse/helpers/with-event-value";import { not, or } from "discourse/truth-helpers";+import DAsyncContent from "discourse/ui-kit/d-async-content.gjs";import DButton from "discourse/ui-kit/d-button";import DExpandingTextArea from "discourse/ui-kit/d-expanding-text-area";import dDiscourseTags from "discourse/ui-kit/helpers/d-discourse-tags";import { i18n } from "discourse-i18n";+async function loadTagsAdminDropdownComponent() {+ const module = await import("discourse/admin/components/tags-admin-dropdown");+ return module.default;+}+export default <template><div class="container"><DiscourseBanner />@@ -66,34 +72,41 @@ export default <template><div class="container tags-controls"><h2>{{i18n "tagging.tags"}}</h2>{{#if @controller.canAdminTags}}- <@controller.TagsAdminDropdownComponent />- <form- class="bulk-create-tags-form"- {{on "submit" @controller.bulkCreateTags}}- >- <label for="bulk-tags-input" class="sr-only">- {{i18n "tagging.bulk_create_inline_placeholder"}}- </label>- <DExpandingTextArea- {{on "input" (withEventValue (fn (mut @controller.bulkTagInput)))}}- @value={{@controller.bulkTagInput}}- placeholder={{i18n "tagging.bulk_create_inline_placeholder"}}- disabled={{@controller.isCreatingTags}}- rows="1"- id="bulk-tags-input"- class="bulk-tags-input"- />- <DButton- @action={{@controller.bulkCreateTags}}- @disabled={{or- @controller.isCreatingTags- (not @controller.canCreateTags)- }}- @icon="tag"- @label="tagging.bulk_create_button"- class="btn-primary"- />- </form>+ <DAsyncContent @asyncData={{(loadTagsAdminDropdownComponent)}}>+ <:content as |TagsAdminDropdownComponent|>+ <TagsAdminDropdownComponent />+ <form+ class="bulk-create-tags-form"+ {{on "submit" @controller.bulkCreateTags}}+ >+ <label for="bulk-tags-input" class="sr-only">+ {{i18n "tagging.bulk_create_inline_placeholder"}}+ </label>+ <DExpandingTextArea+ {{on+ "input"+ (withEventValue (fn (mut @controller.bulkTagInput)))+ }}+ @value={{@controller.bulkTagInput}}+ placeholder={{i18n "tagging.bulk_create_inline_placeholder"}}+ disabled={{@controller.isCreatingTags}}+ rows="1"+ id="bulk-tags-input"+ class="bulk-tags-input"+ />+ <DButton+ @action={{@controller.bulkCreateTags}}+ @disabled={{or+ @controller.isCreatingTags+ (not @controller.canCreateTags)+ }}+ @icon="tag"+ @label="tagging.bulk_create_button"+ class="btn-primary"+ />+ </form>+ </:content>+ </DAsyncContent>{{/if}}</div>