diff --git a/.template-lintrc.js b/.template-lintrc.js
index b5095385b21..e3fc07b48d6 100644
--- a/.template-lintrc.js
+++ b/.template-lintrc.js
@@ -3,7 +3,6 @@ module.exports = {
extends: "discourse:recommended",
rules: {
- "no-action-modifiers": true,
"no-capital-arguments": false, // TODO: we extensively use `args` argument name
"no-curly-component-invocation": {
allow: [
diff --git a/app/assets/javascripts/admin/addon/components/admin-editable-field.js b/app/assets/javascripts/admin/addon/components/admin-editable-field.js
index 892a3208e86..993a3ed6752 100644
--- a/app/assets/javascripts/admin/addon/components/admin-editable-field.js
+++ b/app/assets/javascripts/admin/addon/components/admin-editable-field.js
@@ -1,6 +1,4 @@
import Component from "@ember/component";
-import { action } from "@ember/object";
-
export default Component.extend({
tagName: "",
@@ -12,14 +10,12 @@ export default Component.extend({
this.set("editing", false);
},
- @action
- edit(event) {
- event?.preventDefault();
- this.set("buffer", this.value);
- this.toggleProperty("editing");
- },
-
actions: {
+ edit() {
+ this.set("buffer", this.value);
+ this.toggleProperty("editing");
+ },
+
save() {
// Action has to toggle 'editing' property.
this.action(this.buffer);
diff --git a/app/assets/javascripts/admin/addon/components/admin-theme-editor.js b/app/assets/javascripts/admin/addon/components/admin-theme-editor.js
index de8f0635791..014055c1498 100644
--- a/app/assets/javascripts/admin/addon/components/admin-theme-editor.js
+++ b/app/assets/javascripts/admin/addon/components/admin-theme-editor.js
@@ -3,7 +3,6 @@ import I18n from "I18n";
import discourseComputed from "discourse-common/utils/decorators";
import { fmt } from "discourse/lib/computed";
import { isDocumentRTL } from "discourse/lib/text-direction";
-import { action } from "@ember/object";
import { next } from "@ember/runloop";
export default Component.extend({
@@ -92,26 +91,15 @@ export default Component.extend({
return this.theme.getError(target, fieldName);
},
- @action
- toggleShowAdvanced(event) {
- event?.preventDefault();
- this.toggleProperty("showAdvanced");
- },
-
- @action
- toggleAddField(event) {
- event?.preventDefault();
- this.toggleProperty("addingField");
- },
-
- @action
- toggleMaximize(event) {
- event?.preventDefault();
- this.toggleProperty("maximized");
- next(() => this.appEvents.trigger("ace:resize"));
- },
-
actions: {
+ toggleShowAdvanced() {
+ this.toggleProperty("showAdvanced");
+ },
+
+ toggleAddField() {
+ this.toggleProperty("addingField");
+ },
+
cancelAddField() {
this.set("addingField", false);
},
@@ -126,6 +114,11 @@ export default Component.extend({
this.fieldAdded(this.currentTargetName, name);
},
+ toggleMaximize() {
+ this.toggleProperty("maximized");
+ next(() => this.appEvents.trigger("ace:resize"));
+ },
+
onlyOverriddenChanged(value) {
this.onlyOverriddenChanged(value);
},
diff --git a/app/assets/javascripts/admin/addon/components/ip-lookup.js b/app/assets/javascripts/admin/addon/components/ip-lookup.js
index 02a52405645..222e04b9ab6 100644
--- a/app/assets/javascripts/admin/addon/components/ip-lookup.js
+++ b/app/assets/javascripts/admin/addon/components/ip-lookup.js
@@ -1,6 +1,6 @@
import AdminUser from "admin/models/admin-user";
import Component from "@ember/component";
-import EmberObject, { action } from "@ember/object";
+import EmberObject from "@ember/object";
import I18n from "I18n";
import { ajax } from "discourse/lib/ajax";
import copyText from "discourse/lib/copy-text";
@@ -21,12 +21,6 @@ export default Component.extend({
return Math.max(visible, total);
},
- @action
- hide(event) {
- event?.preventDefault();
- this.set("show", false);
- },
-
actions: {
lookup() {
this.set("show", true);
@@ -61,6 +55,10 @@ export default Component.extend({
}
},
+ hide() {
+ this.set("show", false);
+ },
+
copy() {
let text = `IP: ${this.ip}\n`;
const location = this.location;
diff --git a/app/assets/javascripts/admin/addon/components/themes-list-item.js b/app/assets/javascripts/admin/addon/components/themes-list-item.js
index 29158c44967..e2237e249ba 100644
--- a/app/assets/javascripts/admin/addon/components/themes-list-item.js
+++ b/app/assets/javascripts/admin/addon/components/themes-list-item.js
@@ -3,7 +3,6 @@ import discourseComputed from "discourse-common/utils/decorators";
import Component from "@ember/component";
import { escape } from "pretty-text/sanitizer";
import { iconHTML } from "discourse-common/lib/icon-library";
-import { action } from "@ember/object";
const MAX_COMPONENTS = 4;
@@ -60,9 +59,9 @@ export default Component.extend({
return childrenCount - MAX_COMPONENTS;
},
- @action
- toggleChildrenExpanded(event) {
- event?.preventDefault();
- this.toggleProperty("childrenExpanded");
+ actions: {
+ toggleChildrenExpanded() {
+ this.toggleProperty("childrenExpanded");
+ },
},
});
diff --git a/app/assets/javascripts/admin/addon/controllers/admin-badges/show.js b/app/assets/javascripts/admin/addon/controllers/admin-badges/show.js
index 5b098387ef8..2b380818269 100644
--- a/app/assets/javascripts/admin/addon/controllers/admin-badges/show.js
+++ b/app/assets/javascripts/admin/addon/controllers/admin-badges/show.js
@@ -133,12 +133,6 @@ export default class AdminBadgesShowController extends Controller.extend(
this.buffered.set("image_url", null);
}
- @action
- showPreview(badge, explain, event) {
- event?.preventDefault();
- this.send("preview", badge, explain);
- }
-
@action
save() {
if (!this.saving) {
diff --git a/app/assets/javascripts/admin/addon/controllers/admin-email-bounced.js b/app/assets/javascripts/admin/addon/controllers/admin-email-bounced.js
index c7a8ec98a60..15005495645 100644
--- a/app/assets/javascripts/admin/addon/controllers/admin-email-bounced.js
+++ b/app/assets/javascripts/admin/addon/controllers/admin-email-bounced.js
@@ -2,15 +2,8 @@ import AdminEmailLogsController from "admin/controllers/admin-email-logs";
import { INPUT_DELAY } from "discourse-common/config/environment";
import discourseDebounce from "discourse-common/lib/debounce";
import { observes } from "discourse-common/utils/decorators";
-import { action } from "@ember/object";
export default AdminEmailLogsController.extend({
- @action
- handleShowIncomingEmail(id, event) {
- event?.preventDefault();
- this.send("showIncomingEmail", id);
- },
-
@observes("filter.{status,user,address,type}")
filterEmailLogs() {
discourseDebounce(this, this.loadLogs, INPUT_DELAY);
diff --git a/app/assets/javascripts/admin/addon/controllers/admin-email-preview-digest.js b/app/assets/javascripts/admin/addon/controllers/admin-email-preview-digest.js
index 84f85eea6d3..50d74d35d8e 100644
--- a/app/assets/javascripts/admin/addon/controllers/admin-email-preview-digest.js
+++ b/app/assets/javascripts/admin/addon/controllers/admin-email-preview-digest.js
@@ -1,7 +1,7 @@
import { empty, notEmpty, or } from "@ember/object/computed";
import Controller from "@ember/controller";
import EmailPreview from "admin/models/email-preview";
-import { action, get } from "@ember/object";
+import { get } from "@ember/object";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { inject as service } from "@ember/service";
@@ -14,12 +14,6 @@ export default Controller.extend({
showSendEmailForm: notEmpty("model.html_content"),
htmlEmpty: empty("model.html_content"),
- @action
- toggleShowHtml(event) {
- event?.preventDefault();
- this.toggleProperty("showHtml");
- },
-
actions: {
updateUsername(selected) {
this.set("username", get(selected, "firstObject"));
@@ -45,6 +39,10 @@ export default Controller.extend({
});
},
+ toggleShowHtml() {
+ this.toggleProperty("showHtml");
+ },
+
sendEmail() {
this.set("sendingEmail", true);
this.set("sentEmail", false);
diff --git a/app/assets/javascripts/admin/addon/controllers/admin-email-rejected.js b/app/assets/javascripts/admin/addon/controllers/admin-email-rejected.js
index 6e4ce786568..89c67f3cf95 100644
--- a/app/assets/javascripts/admin/addon/controllers/admin-email-rejected.js
+++ b/app/assets/javascripts/admin/addon/controllers/admin-email-rejected.js
@@ -3,7 +3,6 @@ import { INPUT_DELAY } from "discourse-common/config/environment";
import IncomingEmail from "admin/models/incoming-email";
import discourseDebounce from "discourse-common/lib/debounce";
import { observes } from "discourse-common/utils/decorators";
-import { action } from "@ember/object";
export default AdminEmailLogsController.extend({
@observes("filter.{status,from,to,subject,error}")
@@ -11,12 +10,6 @@ export default AdminEmailLogsController.extend({
discourseDebounce(this, this.loadLogs, IncomingEmail, INPUT_DELAY);
},
- @action
- handleShowIncomingEmail(id, event) {
- event?.preventDefault();
- this.send("showIncomingEmail", id);
- },
-
actions: {
loadMore() {
this.loadLogs(IncomingEmail, true);
diff --git a/app/assets/javascripts/admin/addon/controllers/admin-logs-screened-ip-addresses.js b/app/assets/javascripts/admin/addon/controllers/admin-logs-screened-ip-addresses.js
index bc11ec51f46..0e8b43f9c13 100644
--- a/app/assets/javascripts/admin/addon/controllers/admin-logs-screened-ip-addresses.js
+++ b/app/assets/javascripts/admin/addon/controllers/admin-logs-screened-ip-addresses.js
@@ -6,7 +6,6 @@ import discourseDebounce from "discourse-common/lib/debounce";
import { exportEntity } from "discourse/lib/export-csv";
import { observes } from "discourse-common/utils/decorators";
import { outputExportResult } from "discourse/lib/export-result";
-import { action } from "@ember/object";
import { inject as service } from "@ember/service";
export default Controller.extend({
@@ -27,15 +26,6 @@ export default Controller.extend({
discourseDebounce(this, this._debouncedShow, INPUT_DELAY);
},
- @action
- edit(record, event) {
- event?.preventDefault();
- if (!record.get("editing")) {
- this.set("savedIpAddress", record.get("ip_address"));
- }
- record.set("editing", true);
- },
-
actions: {
allow(record) {
record.set("action_name", "do_nothing");
@@ -47,6 +37,13 @@ export default Controller.extend({
record.save();
},
+ edit(record) {
+ if (!record.get("editing")) {
+ this.set("savedIpAddress", record.get("ip_address"));
+ }
+ record.set("editing", true);
+ },
+
cancel(record) {
const savedIpAddress = this.savedIpAddress;
if (savedIpAddress && record.get("editing")) {
diff --git a/app/assets/javascripts/admin/addon/controllers/admin-logs-staff-action-logs.js b/app/assets/javascripts/admin/addon/controllers/admin-logs-staff-action-logs.js
index a8a297d47c4..670d48c17b9 100644
--- a/app/assets/javascripts/admin/addon/controllers/admin-logs-staff-action-logs.js
+++ b/app/assets/javascripts/admin/addon/controllers/admin-logs-staff-action-logs.js
@@ -1,5 +1,5 @@
import Controller from "@ember/controller";
-import EmberObject, { action } from "@ember/object";
+import EmberObject from "@ember/object";
import I18n from "I18n";
import discourseComputed from "discourse-common/utils/decorators";
import { exportEntity } from "discourse/lib/export-csv";
@@ -31,13 +31,11 @@ export default Controller.extend({
this.set(
"userHistoryActions",
result.extras.user_history_actions
- .map((historyAction) => ({
- id: historyAction.id,
- action_id: historyAction.action_id,
- name: I18n.t(
- "admin.logs.staff_actions.actions." + historyAction.id
- ),
- name_raw: historyAction.id,
+ .map((action) => ({
+ id: action.id,
+ action_id: action.action_id,
+ name: I18n.t("admin.logs.staff_actions.actions." + action.id),
+ name_raw: action.id,
}))
.sort((a, b) => a.name.localeCompare(b.name))
);
@@ -77,74 +75,61 @@ export default Controller.extend({
this.scheduleRefresh();
},
- @action
- filterActionIdChanged(filterActionId) {
- if (filterActionId) {
- this.changeFilters({
- action_name: filterActionId,
- action_id: this.userHistoryActions.findBy("id", filterActionId)
- .action_id,
- });
- }
- },
+ actions: {
+ filterActionIdChanged(filterActionId) {
+ if (filterActionId) {
+ this.changeFilters({
+ action_name: filterActionId,
+ action_id: this.userHistoryActions.findBy("id", filterActionId)
+ .action_id,
+ });
+ }
+ },
- @action
- clearFilter(key, event) {
- event?.preventDefault();
- if (key === "actionFilter") {
+ clearFilter(key) {
+ if (key === "actionFilter") {
+ this.set("filterActionId", null);
+ this.changeFilters({
+ action_name: null,
+ action_id: null,
+ custom_type: null,
+ });
+ } else {
+ this.changeFilters({ [key]: null });
+ }
+ },
+
+ clearAllFilters() {
this.set("filterActionId", null);
+ this.resetFilters();
+ },
+
+ filterByAction(logItem) {
this.changeFilters({
- action_name: null,
- action_id: null,
- custom_type: null,
+ action_name: logItem.get("action_name"),
+ action_id: logItem.get("action"),
+ custom_type: logItem.get("custom_type"),
});
- } else {
- this.changeFilters({ [key]: null });
- }
- },
+ },
- @action
- clearAllFilters(event) {
- event?.preventDefault();
- this.set("filterActionId", null);
- this.resetFilters();
- },
+ filterByStaffUser(acting_user) {
+ this.changeFilters({ acting_user: acting_user.username });
+ },
- @action
- filterByAction(logItem, event) {
- event?.preventDefault();
- this.changeFilters({
- action_name: logItem.get("action_name"),
- action_id: logItem.get("action"),
- custom_type: logItem.get("custom_type"),
- });
- },
+ filterByTargetUser(target_user) {
+ this.changeFilters({ target_user: target_user.username });
+ },
- @action
- filterByStaffUser(acting_user, event) {
- event?.preventDefault();
- this.changeFilters({ acting_user: acting_user.username });
- },
+ filterBySubject(subject) {
+ this.changeFilters({ subject });
+ },
- @action
- filterByTargetUser(target_user, event) {
- event?.preventDefault();
- this.changeFilters({ target_user: target_user.username });
- },
+ exportStaffActionLogs() {
+ exportEntity("staff_action").then(outputExportResult);
+ },
- @action
- filterBySubject(subject, event) {
- event?.preventDefault();
- this.changeFilters({ subject });
- },
-
- @action
- exportStaffActionLogs() {
- exportEntity("staff_action").then(outputExportResult);
- },
-
- @action
- loadMore() {
- this.model.loadMore();
+ loadMore() {
+ this.model.loadMore();
+ },
},
});
diff --git a/app/assets/javascripts/admin/addon/controllers/admin-web-hooks-show-events.js b/app/assets/javascripts/admin/addon/controllers/admin-web-hooks-show-events.js
index 84b7650ff16..71990f47a34 100644
--- a/app/assets/javascripts/admin/addon/controllers/admin-web-hooks-show-events.js
+++ b/app/assets/javascripts/admin/addon/controllers/admin-web-hooks-show-events.js
@@ -1,6 +1,5 @@
import Controller from "@ember/controller";
import { ajax } from "discourse/lib/ajax";
-import { action } from "@ember/object";
import { alias } from "@ember/object/computed";
import discourseComputed from "discourse-common/utils/decorators";
import { popupAjaxError } from "discourse/lib/ajax-error";
@@ -44,23 +43,6 @@ export default Controller.extend({
}
},
- @action
- showInserted(event) {
- event?.preventDefault();
- const webHookId = this.get("model.extras.web_hook_id");
-
- ajax(`/admin/api/web_hooks/${webHookId}/events/bulk`, {
- type: "GET",
- data: { ids: this.incomingEventIds },
- }).then((data) => {
- const objects = data.map((webHookEvent) =>
- this.store.createRecord("web-hook-event", webHookEvent)
- );
- this.model.unshiftObjects(objects);
- this.set("incomingEventIds", []);
- });
- },
-
actions: {
loadMore() {
this.model.loadMore();
@@ -79,5 +61,20 @@ export default Controller.extend({
popupAjaxError(error);
});
},
+
+ showInserted() {
+ const webHookId = this.get("model.extras.web_hook_id");
+
+ ajax(`/admin/api/web_hooks/${webHookId}/events/bulk`, {
+ type: "GET",
+ data: { ids: this.incomingEventIds },
+ }).then((data) => {
+ const objects = data.map((event) =>
+ this.store.createRecord("web-hook-event", event)
+ );
+ this.model.unshiftObjects(objects);
+ this.set("incomingEventIds", []);
+ });
+ },
},
});
diff --git a/app/assets/javascripts/admin/addon/controllers/modals/admin-uploaded-image-list.js b/app/assets/javascripts/admin/addon/controllers/modals/admin-uploaded-image-list.js
index 8a60037a5ba..7ab4cb69848 100644
--- a/app/assets/javascripts/admin/addon/controllers/modals/admin-uploaded-image-list.js
+++ b/app/assets/javascripts/admin/addon/controllers/modals/admin-uploaded-image-list.js
@@ -1,6 +1,5 @@
import { observes, on } from "discourse-common/utils/decorators";
import Controller from "@ember/controller";
-import { action } from "@ember/object";
import ModalFunctionality from "discourse/mixins/modal-functionality";
export default Controller.extend(ModalFunctionality, {
@@ -11,17 +10,15 @@ export default Controller.extend(ModalFunctionality, {
this.set("images", value && value.length ? value.split("|") : []);
},
- @action
- remove(url, event) {
- event?.preventDefault();
- this.images.removeObject(url);
- },
-
actions: {
uploadDone({ url }) {
this.images.addObject(url);
},
+ remove(url) {
+ this.images.removeObject(url);
+ },
+
close() {
this.save(this.images.join("|"));
this.send("closeModal");
diff --git a/app/assets/javascripts/admin/addon/templates/admin-badges/show.hbs b/app/assets/javascripts/admin/addon/templates/admin-badges/show.hbs
index 82492beecb4..31b16af4cc0 100644
--- a/app/assets/javascripts/admin/addon/templates/admin-badges/show.hbs
+++ b/app/assets/javascripts/admin/addon/templates/admin-badges/show.hbs
@@ -88,9 +88,9 @@
{{#if this.hasQuery}}
- {{i18n "admin.badges.preview.link_text"}}
+ {{i18n "admin.badges.preview.link_text"}}
|
- {{i18n "admin.badges.preview.plan_text"}}
+ {{i18n "admin.badges.preview.plan_text"}}
{{#if this.preview_loading}}
{{i18n "loading"}}
{{/if}}
diff --git a/app/assets/javascripts/admin/addon/templates/components/admin-editable-field.hbs b/app/assets/javascripts/admin/addon/templates/components/admin-editable-field.hbs
index 998174f20a9..d62cfdbd783 100644
--- a/app/assets/javascripts/admin/addon/templates/components/admin-editable-field.hbs
+++ b/app/assets/javascripts/admin/addon/templates/components/admin-editable-field.hbs
@@ -3,7 +3,7 @@
{{#if this.editing}}