Skip to content

Commit 85e6276

Browse files
Stop using the deprecated lib/text.cookAsync function
1 parent 0d5a12c commit 85e6276

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

assets/javascripts/discourse/controllers/discourse-post-event-builder.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { action, computed, set } from "@ember/object";
33
import { equal, gte } from "@ember/object/computed";
44
import { inject as service } from "@ember/service";
55
import { extractError } from "discourse/lib/ajax-error";
6-
import { cookAsync } from "discourse/lib/text";
6+
import { cook } from "discourse/lib/text";
77
import ModalFunctionality from "discourse/mixins/modal-functionality";
88
import Group from "discourse/models/group";
99
import I18n from "I18n";
@@ -238,7 +238,7 @@ export default Controller.extend(ModalFunctionality, {
238238
edit_reason: I18n.t("discourse_post_event.destroy_event"),
239239
};
240240

241-
return cookAsync(newRaw).then((cooked) => {
241+
return cook(newRaw).then((cooked) => {
242242
props.cooked = cooked.string;
243243
return post
244244
.save(props)
@@ -293,7 +293,7 @@ export default Controller.extend(ModalFunctionality, {
293293
edit_reason: I18n.t("discourse_post_event.edit_reason"),
294294
};
295295

296-
return cookAsync(newRaw).then((cooked) => {
296+
return cook(newRaw).then((cooked) => {
297297
props.cooked = cooked.string;
298298
return post
299299
.save(props)

assets/javascripts/discourse/initializers/discourse-calendar.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Promise } from "rsvp";
44
import { ajax } from "discourse/lib/ajax";
55
import loadScript from "discourse/lib/load-script";
66
import { withPluginApi } from "discourse/lib/plugin-api";
7-
import { cookAsync } from "discourse/lib/text";
7+
import { cook } from "discourse/lib/text";
88
import DiscourseURL from "discourse/lib/url";
99
import { escapeExpression } from "discourse/lib/utilities";
1010
import Category from "discourse/models/category";
@@ -115,7 +115,7 @@ function initializeDiscourseCalendar(api) {
115115
});
116116

117117
const rawCalendar = `[calendar ${options.join(" ")}]\n[/calendar]`;
118-
const cookRaw = cookAsync(rawCalendar);
118+
const cookRaw = cook(rawCalendar);
119119
const loadPost = ajax(`/posts/${postId}.json`);
120120
Promise.all([cookRaw, loadPost]).then((results) => {
121121
const cooked = results[0];

assets/javascripts/discourse/initializers/discourse-post-event-decorator.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { schedule } from "@ember/runloop";
22
import { applyLocalDates } from "discourse/lib/local-dates";
33
import { withPluginApi } from "discourse/lib/plugin-api";
4-
import { cookAsync } from "discourse/lib/text";
4+
import { cook } from "discourse/lib/text";
55
import WidgetGlue from "discourse/widgets/glue";
66
import { getRegister } from "discourse-common/lib/get-owner";
77
import I18n from "I18n";
@@ -143,7 +143,7 @@ function _attachWidget(api, cooked, eventModel) {
143143
);
144144
}
145145

146-
cookAsync(dates.join("<span> → </span>")).then((result) => {
146+
cook(dates.join("<span> → </span>")).then((result) => {
147147
eventContainer.classList.remove("is-loading");
148148
eventContainer.classList.add("is-loaded");
149149

assets/javascripts/discourse/widgets/discourse-post-event.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { dasherize } from "@ember/string";
33
import { routeAction } from "discourse/helpers/route-action";
44
import { exportEntity } from "discourse/lib/export-csv";
55
import showModal from "discourse/lib/show-modal";
6-
import { cookAsync, emojiUnescape } from "discourse/lib/text";
6+
import { cook, emojiUnescape } from "discourse/lib/text";
77
import { escapeExpression } from "discourse/lib/utilities";
88
import hbs from "discourse/widgets/hbs-compiler";
99
import { createWidget } from "discourse/widgets/widget";
@@ -79,7 +79,7 @@ export default createWidget("discourse-post-event", {
7979
edit_reason: I18n.t("discourse_post_event.edit_reason"),
8080
};
8181

82-
return cookAsync(newRaw).then((cooked) => {
82+
return cook(newRaw).then((cooked) => {
8383
props.cooked = cooked.string;
8484
return post.save(props);
8585
});

0 commit comments

Comments
 (0)