Skip to content

Commit

Permalink
Stop using the deprecated lib/text.cookAsync function
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewPrigorshnev committed Nov 2, 2023
1 parent 0d5a12c commit 85e6276
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { action, computed, set } from "@ember/object";
import { equal, gte } from "@ember/object/computed";
import { inject as service } from "@ember/service";
import { extractError } from "discourse/lib/ajax-error";
import { cookAsync } from "discourse/lib/text";
import { cook } from "discourse/lib/text";
import ModalFunctionality from "discourse/mixins/modal-functionality";
import Group from "discourse/models/group";
import I18n from "I18n";
Expand Down Expand Up @@ -238,7 +238,7 @@ export default Controller.extend(ModalFunctionality, {
edit_reason: I18n.t("discourse_post_event.destroy_event"),
};

return cookAsync(newRaw).then((cooked) => {
return cook(newRaw).then((cooked) => {
props.cooked = cooked.string;
return post
.save(props)
Expand Down Expand Up @@ -293,7 +293,7 @@ export default Controller.extend(ModalFunctionality, {
edit_reason: I18n.t("discourse_post_event.edit_reason"),
};

return cookAsync(newRaw).then((cooked) => {
return cook(newRaw).then((cooked) => {
props.cooked = cooked.string;
return post
.save(props)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Promise } from "rsvp";
import { ajax } from "discourse/lib/ajax";
import loadScript from "discourse/lib/load-script";
import { withPluginApi } from "discourse/lib/plugin-api";
import { cookAsync } from "discourse/lib/text";
import { cook } from "discourse/lib/text";
import DiscourseURL from "discourse/lib/url";
import { escapeExpression } from "discourse/lib/utilities";
import Category from "discourse/models/category";
Expand Down Expand Up @@ -115,7 +115,7 @@ function initializeDiscourseCalendar(api) {
});

const rawCalendar = `[calendar ${options.join(" ")}]\n[/calendar]`;
const cookRaw = cookAsync(rawCalendar);
const cookRaw = cook(rawCalendar);
const loadPost = ajax(`/posts/${postId}.json`);
Promise.all([cookRaw, loadPost]).then((results) => {
const cooked = results[0];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { schedule } from "@ember/runloop";
import { applyLocalDates } from "discourse/lib/local-dates";
import { withPluginApi } from "discourse/lib/plugin-api";
import { cookAsync } from "discourse/lib/text";
import { cook } from "discourse/lib/text";
import WidgetGlue from "discourse/widgets/glue";
import { getRegister } from "discourse-common/lib/get-owner";
import I18n from "I18n";
Expand Down Expand Up @@ -143,7 +143,7 @@ function _attachWidget(api, cooked, eventModel) {
);
}

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

Expand Down
4 changes: 2 additions & 2 deletions assets/javascripts/discourse/widgets/discourse-post-event.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { dasherize } from "@ember/string";
import { routeAction } from "discourse/helpers/route-action";
import { exportEntity } from "discourse/lib/export-csv";
import showModal from "discourse/lib/show-modal";
import { cookAsync, emojiUnescape } from "discourse/lib/text";
import { cook, emojiUnescape } from "discourse/lib/text";
import { escapeExpression } from "discourse/lib/utilities";
import hbs from "discourse/widgets/hbs-compiler";
import { createWidget } from "discourse/widgets/widget";
Expand Down Expand Up @@ -79,7 +79,7 @@ export default createWidget("discourse-post-event", {
edit_reason: I18n.t("discourse_post_event.edit_reason"),
};

return cookAsync(newRaw).then((cooked) => {
return cook(newRaw).then((cooked) => {
props.cooked = cooked.string;
return post.save(props);
});
Expand Down

0 comments on commit 85e6276

Please sign in to comment.