DEV: Update references from `controller:composer` to `service:composer`
This commit is contained in:
parent
346d80b582
commit
22991bba44
|
@ -1,10 +1,11 @@
|
||||||
import { not, or, reads } from "@ember/object/computed";
|
import { not, or, reads } from "@ember/object/computed";
|
||||||
import discourseComputed from "discourse-common/utils/decorators";
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { getOwner } from "discourse-common/lib/get-owner";
|
|
||||||
import { htmlSafe } from "@ember/template";
|
import { htmlSafe } from "@ember/template";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
|
composer: service(),
|
||||||
tagName: "a",
|
tagName: "a",
|
||||||
classNameBindings: [":popup-tip", "good", "bad", "lastShownAt::hide"],
|
classNameBindings: [":popup-tip", "good", "bad", "lastShownAt::hide"],
|
||||||
attributeBindings: ["role", "ariaLabel", "tabindex"],
|
attributeBindings: ["role", "ariaLabel", "tabindex"],
|
||||||
|
@ -28,8 +29,7 @@ export default Component.extend({
|
||||||
|
|
||||||
dismiss() {
|
dismiss() {
|
||||||
this.set("shownAt", null);
|
this.set("shownAt", null);
|
||||||
const composer = getOwner(this).lookup("controller:composer");
|
this.composer.clearLastValidatedAt();
|
||||||
composer.clearLastValidatedAt();
|
|
||||||
this.element.previousElementSibling?.focus();
|
this.element.previousElementSibling?.focus();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,11 @@ import SidebarCommonCommunitySection from "discourse/components/sidebar/common/c
|
||||||
|
|
||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
import { next } from "@ember/runloop";
|
import { next } from "@ember/runloop";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default class SidebarUserCommunitySection extends SidebarCommonCommunitySection {
|
export default class SidebarUserCommunitySection extends SidebarCommonCommunitySection {
|
||||||
|
@service composer;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super(...arguments);
|
super(...arguments);
|
||||||
|
|
||||||
|
@ -68,7 +71,7 @@ export default class SidebarUserCommunitySection extends SidebarCommonCommunityS
|
||||||
}
|
}
|
||||||
|
|
||||||
next(() => {
|
next(() => {
|
||||||
getOwner(this).lookup("controller:composer").open(composerArgs);
|
this.composer.open(composerArgs);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import I18n from "I18n";
|
||||||
import LoadMore from "discourse/mixins/load-more";
|
import LoadMore from "discourse/mixins/load-more";
|
||||||
import Post from "discourse/models/post";
|
import Post from "discourse/models/post";
|
||||||
import { NEW_TOPIC_KEY } from "discourse/models/composer";
|
import { NEW_TOPIC_KEY } from "discourse/models/composer";
|
||||||
import { getOwner } from "discourse-common/lib/get-owner";
|
|
||||||
import { observes } from "discourse-common/utils/decorators";
|
import { observes } from "discourse-common/utils/decorators";
|
||||||
import { on } from "@ember/object/evented";
|
import { on } from "@ember/object/evented";
|
||||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||||
|
@ -16,6 +15,7 @@ import { inject as service } from "@ember/service";
|
||||||
export default Component.extend(LoadMore, {
|
export default Component.extend(LoadMore, {
|
||||||
tagName: "ul",
|
tagName: "ul",
|
||||||
dialog: service(),
|
dialog: service(),
|
||||||
|
composer: service(),
|
||||||
_lastDecoratedElement: null,
|
_lastDecoratedElement: null,
|
||||||
|
|
||||||
_initialize: on("init", function () {
|
_initialize: on("init", function () {
|
||||||
|
@ -100,9 +100,8 @@ export default Component.extend(LoadMore, {
|
||||||
},
|
},
|
||||||
|
|
||||||
resumeDraft(item) {
|
resumeDraft(item) {
|
||||||
const composer = getOwner(this).lookup("controller:composer");
|
if (this.composer.get("model.viewOpen")) {
|
||||||
if (composer.get("model.viewOpen")) {
|
this.composer.close();
|
||||||
composer.close();
|
|
||||||
}
|
}
|
||||||
if (item.get("postUrl")) {
|
if (item.get("postUrl")) {
|
||||||
DiscourseURL.routeTo(item.get("postUrl"));
|
DiscourseURL.routeTo(item.get("postUrl"));
|
||||||
|
@ -114,7 +113,7 @@ export default Component.extend(LoadMore, {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
composer.open({
|
this.composer.open({
|
||||||
draft,
|
draft,
|
||||||
draftKey: item.draft_key,
|
draftKey: item.draft_key,
|
||||||
draftSequence: d.draft_sequence,
|
draftSequence: d.draft_sequence,
|
||||||
|
|
|
@ -22,6 +22,7 @@ import { Promise } from "rsvp";
|
||||||
import { search as searchCategoryTag } from "discourse/lib/category-tag-search";
|
import { search as searchCategoryTag } from "discourse/lib/category-tag-search";
|
||||||
import showModal from "discourse/lib/show-modal";
|
import showModal from "discourse/lib/show-modal";
|
||||||
import userSearch from "discourse/lib/user-search";
|
import userSearch from "discourse/lib/user-search";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
const SortOrders = [
|
const SortOrders = [
|
||||||
{ name: I18n.t("search.relevance"), id: 0 },
|
{ name: I18n.t("search.relevance"), id: 0 },
|
||||||
|
@ -49,7 +50,7 @@ export function registerFullPageSearchType(
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
application: controller(),
|
application: controller(),
|
||||||
composer: controller(),
|
composer: service(),
|
||||||
bulkSelectEnabled: null,
|
bulkSelectEnabled: null,
|
||||||
|
|
||||||
loading: false,
|
loading: false,
|
||||||
|
|
|
@ -47,7 +47,7 @@ export function registerCustomPostMessageCallback(type, callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Controller.extend(bufferedProperty("model"), {
|
export default Controller.extend(bufferedProperty("model"), {
|
||||||
composer: controller(),
|
composer: service(),
|
||||||
application: controller(),
|
application: controller(),
|
||||||
dialog: service(),
|
dialog: service(),
|
||||||
documentTitle: service(),
|
documentTitle: service(),
|
||||||
|
|
|
@ -445,14 +445,14 @@ export default {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.container.lookup("controller:composer").open({
|
this.container.lookup("service:composer").open({
|
||||||
action: Composer.CREATE_TOPIC,
|
action: Composer.CREATE_TOPIC,
|
||||||
draftKey: Composer.NEW_TOPIC_KEY,
|
draftKey: Composer.NEW_TOPIC_KEY,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
focusComposer(event) {
|
focusComposer(event) {
|
||||||
const composer = this.container.lookup("controller:composer");
|
const composer = this.container.lookup("service:composer");
|
||||||
if (event) {
|
if (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
@ -461,7 +461,7 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
fullscreenComposer() {
|
fullscreenComposer() {
|
||||||
const composer = this.container.lookup("controller:composer");
|
const composer = this.container.lookup("service:composer");
|
||||||
if (composer.get("model")) {
|
if (composer.get("model")) {
|
||||||
composer.toggleFullscreen();
|
composer.toggleFullscreen();
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ import { addPluginReviewableParam } from "discourse/components/reviewable-item";
|
||||||
import {
|
import {
|
||||||
addComposerSaveErrorCallback,
|
addComposerSaveErrorCallback,
|
||||||
addPopupMenuOptionsCallback,
|
addPopupMenuOptionsCallback,
|
||||||
} from "discourse/controllers/composer";
|
} from "discourse/services/composer";
|
||||||
import { addPostClassesCallback } from "discourse/widgets/post";
|
import { addPostClassesCallback } from "discourse/widgets/post";
|
||||||
import {
|
import {
|
||||||
addGroupPostSmallActionCode,
|
addGroupPostSmallActionCode,
|
||||||
|
|
|
@ -409,7 +409,7 @@ const DiscourseURL = EmberObject.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
get isComposerOpen() {
|
get isComposerOpen() {
|
||||||
return this.controllerFor("composer")?.visible;
|
return this.container.lookup("service:composer")?.visible;
|
||||||
},
|
},
|
||||||
|
|
||||||
get router() {
|
get router() {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// This mixin allows a route to open the composer
|
// This mixin allows a route to open the composer
|
||||||
import Composer from "discourse/models/composer";
|
import Composer from "discourse/models/composer";
|
||||||
import Mixin from "@ember/object/mixin";
|
import Mixin from "@ember/object/mixin";
|
||||||
|
import { getOwner } from "discourse-common/lib/get-owner";
|
||||||
|
|
||||||
export default Mixin.create({
|
export default Mixin.create({
|
||||||
openComposer(controller) {
|
openComposer(controller) {
|
||||||
|
@ -13,7 +14,9 @@ export default Mixin.create({
|
||||||
categoryId = null;
|
categoryId = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.controllerFor("composer").open({
|
getOwner(this)
|
||||||
|
.lookup("service:composer")
|
||||||
|
.open({
|
||||||
prioritizedCategoryId: categoryId,
|
prioritizedCategoryId: categoryId,
|
||||||
topicCategoryId: categoryId,
|
topicCategoryId: categoryId,
|
||||||
action: Composer.CREATE_TOPIC,
|
action: Composer.CREATE_TOPIC,
|
||||||
|
@ -29,7 +32,9 @@ export default Mixin.create({
|
||||||
topicCategoryId,
|
topicCategoryId,
|
||||||
topicTags
|
topicTags
|
||||||
) {
|
) {
|
||||||
this.controllerFor("composer").open({
|
getOwner(this)
|
||||||
|
.lookup("service:composer")
|
||||||
|
.open({
|
||||||
action: Composer.CREATE_TOPIC,
|
action: Composer.CREATE_TOPIC,
|
||||||
topicTitle,
|
topicTitle,
|
||||||
topicBody,
|
topicBody,
|
||||||
|
@ -46,7 +51,7 @@ export default Mixin.create({
|
||||||
topicBody = "",
|
topicBody = "",
|
||||||
hasGroups = false,
|
hasGroups = false,
|
||||||
} = {}) {
|
} = {}) {
|
||||||
this.controllerFor("composer").open({
|
getOwner(this).lookup("service:composer").open({
|
||||||
action: Composer.PRIVATE_MESSAGE,
|
action: Composer.PRIVATE_MESSAGE,
|
||||||
recipients,
|
recipients,
|
||||||
topicTitle,
|
topicTitle,
|
||||||
|
|
|
@ -39,6 +39,7 @@ const ApplicationRoute = DiscourseRoute.extend(OpenComposer, {
|
||||||
shortSiteDescription: setting("short_site_description"),
|
shortSiteDescription: setting("short_site_description"),
|
||||||
documentTitle: service(),
|
documentTitle: service(),
|
||||||
dialog: service(),
|
dialog: service(),
|
||||||
|
composer: service(),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
toggleAnonymous() {
|
toggleAnonymous() {
|
||||||
|
@ -84,7 +85,7 @@ const ApplicationRoute = DiscourseRoute.extend(OpenComposer, {
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
// used only once, one less dependency
|
// used only once, one less dependency
|
||||||
return this.controllerFor("composer").open({
|
return this.composer.open({
|
||||||
action: Composer.PRIVATE_MESSAGE,
|
action: Composer.PRIVATE_MESSAGE,
|
||||||
recipients,
|
recipients,
|
||||||
archetypeId: "private_message",
|
archetypeId: "private_message",
|
||||||
|
|
|
@ -16,11 +16,13 @@ import PermissionType from "discourse/models/permission-type";
|
||||||
import TopicList from "discourse/models/topic-list";
|
import TopicList from "discourse/models/topic-list";
|
||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
import PreloadStore from "discourse/lib/preload-store";
|
import PreloadStore from "discourse/lib/preload-store";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
// A helper function to create a category route with parameters
|
// A helper function to create a category route with parameters
|
||||||
export default (filterArg, params) => {
|
export default (filterArg, params) => {
|
||||||
return DiscourseRoute.extend({
|
return DiscourseRoute.extend({
|
||||||
queryParams,
|
queryParams,
|
||||||
|
composer: service(),
|
||||||
|
|
||||||
model(modelParams) {
|
model(modelParams) {
|
||||||
const category = Category.findBySlugPathWithID(
|
const category = Category.findBySlugPathWithID(
|
||||||
|
@ -209,7 +211,7 @@ export default (filterArg, params) => {
|
||||||
deactivate() {
|
deactivate() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
|
||||||
this.controllerFor("composer").set("prioritizedCategoryId", null);
|
this.composer.set("prioritizedCategoryId", null);
|
||||||
this.searchService.set("searchContext", null);
|
this.searchService.set("searchContext", null);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ import Draft from "discourse/models/draft";
|
||||||
import Route from "@ember/routing/route";
|
import Route from "@ember/routing/route";
|
||||||
import { once } from "@ember/runloop";
|
import { once } from "@ember/runloop";
|
||||||
import { seenUser } from "discourse/lib/user-presence";
|
import { seenUser } from "discourse/lib/user-presence";
|
||||||
|
import { getOwner } from "discourse-common/lib/get-owner";
|
||||||
|
|
||||||
const DiscourseRoute = Route.extend({
|
const DiscourseRoute = Route.extend({
|
||||||
showFooter: false,
|
showFooter: false,
|
||||||
|
@ -53,7 +54,7 @@ const DiscourseRoute = Route.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
openTopicDraft() {
|
openTopicDraft() {
|
||||||
const composer = this.controllerFor("composer");
|
const composer = getOwner(this).lookup("service:composer");
|
||||||
|
|
||||||
if (
|
if (
|
||||||
composer.get("model.action") === Composer.CREATE_TOPIC &&
|
composer.get("model.action") === Composer.CREATE_TOPIC &&
|
||||||
|
|
|
@ -18,11 +18,13 @@ import { setTopicList } from "discourse/lib/topic-list-tracker";
|
||||||
import showModal from "discourse/lib/show-modal";
|
import showModal from "discourse/lib/show-modal";
|
||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
import PreloadStore from "discourse/lib/preload-store";
|
import PreloadStore from "discourse/lib/preload-store";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
const NONE = "none";
|
const NONE = "none";
|
||||||
const ALL = "all";
|
const ALL = "all";
|
||||||
|
|
||||||
export default DiscourseRoute.extend(FilterModeMixin, {
|
export default DiscourseRoute.extend(FilterModeMixin, {
|
||||||
|
composer: service(),
|
||||||
navMode: "latest",
|
navMode: "latest",
|
||||||
|
|
||||||
queryParams,
|
queryParams,
|
||||||
|
@ -214,8 +216,7 @@ export default DiscourseRoute.extend(FilterModeMixin, {
|
||||||
this.openTopicDraft();
|
this.openTopicDraft();
|
||||||
} else {
|
} else {
|
||||||
const controller = this.controllerFor("tag.show");
|
const controller = this.controllerFor("tag.show");
|
||||||
const composerController = this.controllerFor("composer");
|
this.composer
|
||||||
composerController
|
|
||||||
.open({
|
.open({
|
||||||
categoryId: controller.category?.id,
|
categoryId: controller.category?.id,
|
||||||
action: Composer.CREATE_TOPIC,
|
action: Composer.CREATE_TOPIC,
|
||||||
|
@ -223,8 +224,8 @@ export default DiscourseRoute.extend(FilterModeMixin, {
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// Pre-fill the tags input field
|
// Pre-fill the tags input field
|
||||||
if (composerController.canEditTags && controller.tag?.id) {
|
if (this.composer.canEditTags && controller.tag?.id) {
|
||||||
const composerModel = this.controllerFor("composer").model;
|
const composerModel = this.composer.model;
|
||||||
composerModel.set("tags", this._controllerTags(controller));
|
composerModel.set("tags", this._controllerTags(controller));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,9 +5,12 @@ import { isEmpty } from "@ember/utils";
|
||||||
import { isTesting } from "discourse-common/config/environment";
|
import { isTesting } from "discourse-common/config/environment";
|
||||||
import { schedule } from "@ember/runloop";
|
import { schedule } from "@ember/runloop";
|
||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
// This route is used for retrieving a topic based on params
|
// This route is used for retrieving a topic based on params
|
||||||
export default DiscourseRoute.extend({
|
export default DiscourseRoute.extend({
|
||||||
|
composer: service(),
|
||||||
|
|
||||||
// Avoid default model hook
|
// Avoid default model hook
|
||||||
model(params) {
|
model(params) {
|
||||||
params = params || {};
|
params = params || {};
|
||||||
|
@ -56,7 +59,6 @@ export default DiscourseRoute.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
const topicController = this.controllerFor("topic");
|
const topicController = this.controllerFor("topic");
|
||||||
const composerController = this.controllerFor("composer");
|
|
||||||
const topic = this.modelFor("topic");
|
const topic = this.modelFor("topic");
|
||||||
const postStream = topic.postStream;
|
const postStream = topic.postStream;
|
||||||
|
|
||||||
|
@ -105,7 +107,7 @@ export default DiscourseRoute.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isEmpty(topic.draft)) {
|
if (!isEmpty(topic.draft)) {
|
||||||
composerController.open({
|
this.composer.open({
|
||||||
draft: Draft.getLocal(topic.draft_key, topic.draft),
|
draft: Draft.getLocal(topic.draft_key, topic.draft),
|
||||||
draftKey: topic.draft_key,
|
draftKey: topic.draft_key,
|
||||||
draftSequence: topic.draft_sequence,
|
draftSequence: topic.draft_sequence,
|
||||||
|
|
|
@ -14,6 +14,7 @@ import PostFlag from "discourse/lib/flag-targets/post-flag";
|
||||||
const SCROLL_DELAY = 500;
|
const SCROLL_DELAY = 500;
|
||||||
|
|
||||||
const TopicRoute = DiscourseRoute.extend({
|
const TopicRoute = DiscourseRoute.extend({
|
||||||
|
composer: service(),
|
||||||
screenTrack: service(),
|
screenTrack: service(),
|
||||||
|
|
||||||
scheduledReplace: null,
|
scheduledReplace: null,
|
||||||
|
@ -332,7 +333,7 @@ const TopicRoute = DiscourseRoute.extend({
|
||||||
postStream.cancelFilter();
|
postStream.cancelFilter();
|
||||||
|
|
||||||
topicController.set("multiSelect", false);
|
topicController.set("multiSelect", false);
|
||||||
this.controllerFor("composer").set("topic", null);
|
this.composer.set("topic", null);
|
||||||
this.screenTrack.stop();
|
this.screenTrack.stop();
|
||||||
|
|
||||||
this.appEvents.trigger("header:hide-topic");
|
this.appEvents.trigger("header:hide-topic");
|
||||||
|
@ -356,7 +357,7 @@ const TopicRoute = DiscourseRoute.extend({
|
||||||
controller.set("multiSelect", false);
|
controller.set("multiSelect", false);
|
||||||
controller.get("quoteState").clear();
|
controller.get("quoteState").clear();
|
||||||
|
|
||||||
this.controllerFor("composer").set("topic", model);
|
this.composer.set("topic", model);
|
||||||
this.topicTrackingState.trackIncoming("all");
|
this.topicTrackingState.trackIncoming("all");
|
||||||
|
|
||||||
// We reset screen tracking every time a topic is entered
|
// We reset screen tracking every time a topic is entered
|
||||||
|
|
|
@ -2,8 +2,11 @@ import Composer from "discourse/models/composer";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import Draft from "discourse/models/draft";
|
import Draft from "discourse/models/draft";
|
||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default DiscourseRoute.extend({
|
||||||
|
composer: service(),
|
||||||
|
|
||||||
renderTemplate() {
|
renderTemplate() {
|
||||||
this.render("user/messages");
|
this.render("user/messages");
|
||||||
},
|
},
|
||||||
|
@ -20,11 +23,9 @@ export default DiscourseRoute.extend({
|
||||||
controller.set("model", model);
|
controller.set("model", model);
|
||||||
|
|
||||||
if (this.currentUser) {
|
if (this.currentUser) {
|
||||||
const composerController = this.controllerFor("composer");
|
|
||||||
|
|
||||||
Draft.get("new_private_message").then((data) => {
|
Draft.get("new_private_message").then((data) => {
|
||||||
if (data.draft) {
|
if (data.draft) {
|
||||||
composerController.open({
|
this.composer.open({
|
||||||
draft: data.draft,
|
draft: data.draft,
|
||||||
draftKey: Composer.NEW_PRIVATE_MESSAGE_KEY,
|
draftKey: Composer.NEW_PRIVATE_MESSAGE_KEY,
|
||||||
ignoreIfChanged: true,
|
ignoreIfChanged: true,
|
||||||
|
|
|
@ -12,7 +12,7 @@ import I18n from "I18n";
|
||||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||||
import sinon from "sinon";
|
import sinon from "sinon";
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
import { toggleCheckDraftPopup } from "discourse/controllers/composer";
|
import { toggleCheckDraftPopup } from "discourse/services/composer";
|
||||||
import userFixtures from "discourse/tests/fixtures/user-fixtures";
|
import userFixtures from "discourse/tests/fixtures/user-fixtures";
|
||||||
import { cloneJSON } from "discourse-common/lib/object";
|
import { cloneJSON } from "discourse-common/lib/object";
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import {
|
||||||
triggerKeyEvent,
|
triggerKeyEvent,
|
||||||
visit,
|
visit,
|
||||||
} from "@ember/test-helpers";
|
} from "@ember/test-helpers";
|
||||||
import { toggleCheckDraftPopup } from "discourse/controllers/composer";
|
import { toggleCheckDraftPopup } from "discourse/services/composer";
|
||||||
import { cloneJSON } from "discourse-common/lib/object";
|
import { cloneJSON } from "discourse-common/lib/object";
|
||||||
import TopicFixtures from "discourse/tests/fixtures/topic";
|
import TopicFixtures from "discourse/tests/fixtures/topic";
|
||||||
import LinkLookup from "discourse/lib/link-lookup";
|
import LinkLookup from "discourse/lib/link-lookup";
|
||||||
|
@ -1016,7 +1016,7 @@ acceptance("Composer", function (needs) {
|
||||||
await visit("/t/internationalization-localization/280");
|
await visit("/t/internationalization-localization/280");
|
||||||
await click("#topic-footer-buttons .create");
|
await click("#topic-footer-buttons .create");
|
||||||
|
|
||||||
this.container.lookup("controller:composer").set(
|
this.container.lookup("service:composer").set(
|
||||||
"linkLookup",
|
"linkLookup",
|
||||||
new LinkLookup({
|
new LinkLookup({
|
||||||
"github.com": {
|
"github.com": {
|
||||||
|
@ -1185,7 +1185,7 @@ acceptance("Composer - Focus Open and Closed", function (needs) {
|
||||||
test("Focusing a composer which is not open with create topic", async function (assert) {
|
test("Focusing a composer which is not open with create topic", async function (assert) {
|
||||||
await visit("/t/internationalization-localization/280");
|
await visit("/t/internationalization-localization/280");
|
||||||
|
|
||||||
const composer = this.container.lookup("controller:composer");
|
const composer = this.container.lookup("service:composer");
|
||||||
await composer.focusComposer({ fallbackToNewTopic: true });
|
await composer.focusComposer({ fallbackToNewTopic: true });
|
||||||
|
|
||||||
await settled();
|
await settled();
|
||||||
|
@ -1200,7 +1200,7 @@ acceptance("Composer - Focus Open and Closed", function (needs) {
|
||||||
test("Focusing a composer which is not open with create topic and append text", async function (assert) {
|
test("Focusing a composer which is not open with create topic and append text", async function (assert) {
|
||||||
await visit("/t/internationalization-localization/280");
|
await visit("/t/internationalization-localization/280");
|
||||||
|
|
||||||
const composer = this.container.lookup("controller:composer");
|
const composer = this.container.lookup("service:composer");
|
||||||
await composer.focusComposer({
|
await composer.focusComposer({
|
||||||
fallbackToNewTopic: true,
|
fallbackToNewTopic: true,
|
||||||
insertText: "this is appended",
|
insertText: "this is appended",
|
||||||
|
@ -1222,7 +1222,7 @@ acceptance("Composer - Focus Open and Closed", function (needs) {
|
||||||
await visit("/");
|
await visit("/");
|
||||||
await click("#create-topic");
|
await click("#create-topic");
|
||||||
|
|
||||||
const composer = this.container.lookup("controller:composer");
|
const composer = this.container.lookup("service:composer");
|
||||||
await composer.focusComposer();
|
await composer.focusComposer();
|
||||||
|
|
||||||
await settled();
|
await settled();
|
||||||
|
@ -1237,7 +1237,7 @@ acceptance("Composer - Focus Open and Closed", function (needs) {
|
||||||
await visit("/");
|
await visit("/");
|
||||||
await click("#create-topic");
|
await click("#create-topic");
|
||||||
|
|
||||||
const composer = this.container.lookup("controller:composer");
|
const composer = this.container.lookup("service:composer");
|
||||||
await composer.focusComposer({ insertText: "this is some appended text" });
|
await composer.focusComposer({ insertText: "this is some appended text" });
|
||||||
|
|
||||||
await settled();
|
await settled();
|
||||||
|
@ -1259,7 +1259,7 @@ acceptance("Composer - Focus Open and Closed", function (needs) {
|
||||||
await fillIn(".d-editor-input", "This is a dirty reply");
|
await fillIn(".d-editor-input", "This is a dirty reply");
|
||||||
await click(".toggle-minimize");
|
await click(".toggle-minimize");
|
||||||
|
|
||||||
const composer = this.container.lookup("controller:composer");
|
const composer = this.container.lookup("service:composer");
|
||||||
await composer.focusComposer({ insertText: "this is some appended text" });
|
await composer.focusComposer({ insertText: "this is some appended text" });
|
||||||
|
|
||||||
await settled();
|
await settled();
|
||||||
|
|
|
@ -542,7 +542,7 @@ acceptance("Tag info", function (needs) {
|
||||||
test("composer will not set tags if user cannot create them", async function (assert) {
|
test("composer will not set tags if user cannot create them", async function (assert) {
|
||||||
await visit("/tag/planters");
|
await visit("/tag/planters");
|
||||||
await click("#create-topic");
|
await click("#create-topic");
|
||||||
let composer = this.owner.lookup("controller:composer");
|
let composer = this.owner.lookup("service:composer");
|
||||||
assert.strictEqual(composer.get("model").tags, undefined);
|
assert.strictEqual(composer.get("model").tags, undefined);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -611,7 +611,7 @@ acceptance("Tag show - create topic", function (needs) {
|
||||||
});
|
});
|
||||||
|
|
||||||
test("composer will not set tags with all/none tags when creating topic", async function (assert) {
|
test("composer will not set tags with all/none tags when creating topic", async function (assert) {
|
||||||
const composer = this.owner.lookup("controller:composer");
|
const composer = this.owner.lookup("service:composer");
|
||||||
|
|
||||||
await visit("/tag/none");
|
await visit("/tag/none");
|
||||||
await click("#create-topic");
|
await click("#create-topic");
|
||||||
|
@ -623,7 +623,7 @@ acceptance("Tag show - create topic", function (needs) {
|
||||||
});
|
});
|
||||||
|
|
||||||
test("composer will set tags from selected tag", async function (assert) {
|
test("composer will set tags from selected tag", async function (assert) {
|
||||||
const composer = this.owner.lookup("controller:composer");
|
const composer = this.owner.lookup("service:composer");
|
||||||
|
|
||||||
await visit("/tag/planters");
|
await visit("/tag/planters");
|
||||||
await click("#create-topic");
|
await click("#create-topic");
|
||||||
|
|
Loading…
Reference in New Issue