A platform for community discussion. Free, open, simple.
DEV: Remove usage of {{action}} modifiers - Take 2 (#18476)
Dan Gebhardt03b7b7d1bc7c
diff --git a/.template-lintrc.js b/.template-lintrc.jsindex e3fc07b48d6..b5095385b21 100644--- a/.template-lintrc.js+++ b/.template-lintrc.js@@ -3,6 +3,7 @@ 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.jsindex 993a3ed6752..892a3208e86 100644--- a/app/assets/javascripts/admin/addon/components/admin-editable-field.js+++ b/app/assets/javascripts/admin/addon/components/admin-editable-field.js@@ -1,4 +1,6 @@import Component from "@ember/component";+import { action } from "@ember/object";+export default Component.extend({tagName: "",@@ -10,12 +12,14 @@ export default Component.extend({this.set("editing", false);},- actions: {- edit() {- this.set("buffer", this.value);- this.toggleProperty("editing");- },+ @action+ edit(event) {+ event?.preventDefault();+ this.set("buffer", this.value);+ this.toggleProperty("editing");+ },+ actions: {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.jsindex 014055c1498..de8f0635791 100644--- a/app/assets/javascripts/admin/addon/components/admin-theme-editor.js+++ b/app/assets/javascripts/admin/addon/components/admin-theme-editor.js@@ -3,6 +3,7 @@ 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({@@ -91,15 +92,26 @@ export default Component.extend({return this.theme.getError(target, fieldName);},- actions: {- toggleShowAdvanced() {- this.toggleProperty("showAdvanced");- },+ @action+ toggleShowAdvanced(event) {+ event?.preventDefault();+ this.toggleProperty("showAdvanced");+ },- toggleAddField() {- this.toggleProperty("addingField");- },+ @action+ toggleAddField(event) {+ event?.preventDefault();+ this.toggleProperty("addingField");+ },+ @action+ toggleMaximize(event) {+ event?.preventDefault();+ this.toggleProperty("maximized");+ next(() => this.appEvents.trigger("ace:resize"));+ },++ actions: {cancelAddField() {this.set("addingField", false);},@@ -114,11 +126,6 @@ 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.jsindex 222e04b9ab6..02a52405645 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 from "@ember/object";+import EmberObject, { action } from "@ember/object";import I18n from "I18n";import { ajax } from "discourse/lib/ajax";import copyText from "discourse/lib/copy-text";@@ -21,6 +21,12 @@ export default Component.extend({return Math.max(visible, total);},+ @action+ hide(event) {+ event?.preventDefault();+ this.set("show", false);+ },+actions: {lookup() {this.set("show", true);@@ -55,10 +61,6 @@ 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.jsindex e2237e249ba..29158c44967 100644--- a/app/assets/javascripts/admin/addon/components/themes-list-item.js+++ b/app/assets/javascripts/admin/addon/components/themes-list-item.js@@ -3,6 +3,7 @@ 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;@@ -59,9 +60,9 @@ export default Component.extend({return childrenCount - MAX_COMPONENTS;},- actions: {- toggleChildrenExpanded() {- this.toggleProperty("childrenExpanded");- },+ @action+ toggleChildrenExpanded(event) {+ event?.preventDefault();+ 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.jsindex 2b380818269..5b098387ef8 100644--- a/app/assets/javascripts/admin/addon/controllers/admin-badges/show.js+++ b/app/assets/javascripts/admin/addon/controllers/admin-badges/show.js@@ -133,6 +133,12 @@ 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);+ }+@actionsave() {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.jsindex 15005495645..c7a8ec98a60 100644--- a/app/assets/javascripts/admin/addon/controllers/admin-email-bounced.js+++ b/app/assets/javascripts/admin/addon/controllers/admin-email-bounced.js@@ -2,8 +2,15 @@ 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.jsindex 50d74d35d8e..84f85eea6d3 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 { get } from "@ember/object";+import { action, get } from "@ember/object";import { popupAjaxError } from "discourse/lib/ajax-error";import { inject as service } from "@ember/service";@@ -14,6 +14,12 @@ 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"));@@ -39,10 +45,6 @@ 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.jsindex 89c67f3cf95..6e4ce786568 100644--- a/app/assets/javascripts/admin/addon/controllers/admin-email-rejected.js+++ b/app/assets/javascripts/admin/addon/controllers/admin-email-rejected.js@@ -3,6 +3,7 @@ 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}")@@ -10,6 +11,12 @@ 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.jsindex 0e8b43f9c13..bc11ec51f46 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,6 +6,7 @@ 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({@@ -26,6 +27,15 @@ 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");@@ -37,13 +47,6 @@ 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.jsindex 670d48c17b9..a8a297d47c4 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 from "@ember/object";+import EmberObject, { action } from "@ember/object";import I18n from "I18n";import discourseComputed from "discourse-common/utils/decorators";import { exportEntity } from "discourse/lib/export-csv";@@ -31,11 +31,13 @@ export default Controller.extend({this.set("userHistoryActions",result.extras.user_history_actions- .map((action) => ({- id: action.id,- action_id: action.action_id,- name: I18n.t("admin.logs.staff_actions.actions." + action.id),- name_raw: action.id,+ .map((historyAction) => ({+ id: historyAction.id,+ action_id: historyAction.action_id,+ name: I18n.t(+ "admin.logs.staff_actions.actions." + historyAction.id+ ),+ name_raw: historyAction.id,})).sort((a, b) => a.name.localeCompare(b.name)));@@ -75,61 +77,74 @@ export default Controller.extend({this.scheduleRefresh();},- actions: {- filterActionIdChanged(filterActionId) {- if (filterActionId) {- this.changeFilters({- action_name: filterActionId,- action_id: this.userHistoryActions.findBy("id", filterActionId)- .action_id,- });- }- },-- 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 });- }- },+ @action+ filterActionIdChanged(filterActionId) {+ if (filterActionId) {+ this.changeFilters({+ action_name: filterActionId,+ action_id: this.userHistoryActions.findBy("id", filterActionId)+ .action_id,+ });+ }+ },- clearAllFilters() {+ @action+ clearFilter(key, event) {+ event?.preventDefault();+ if (key === "actionFilter") {this.set("filterActionId", null);- this.resetFilters();- },-- filterByAction(logItem) {this.changeFilters({- action_name: logItem.get("action_name"),- action_id: logItem.get("action"),- custom_type: logItem.get("custom_type"),+ action_name: null,+ action_id: null,+ custom_type: null,});- },+ } else {+ this.changeFilters({ [key]: null });+ }+ },- filterByStaffUser(acting_user) {- this.changeFilters({ acting_user: acting_user.username });- },+ @action+ clearAllFilters(event) {+ event?.preventDefault();+ this.set("filterActionId", null);+ this.resetFilters();+ },- filterByTargetUser(target_user) {- this.changeFilters({ target_user: target_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"),+ });+ },- filterBySubject(subject) {- this.changeFilters({ subject });- },+ @action+ filterByStaffUser(acting_user, event) {+ event?.preventDefault();+ this.changeFilters({ acting_user: acting_user.username });+ },- exportStaffActionLogs() {- exportEntity("staff_action").then(outputExportResult);- },+ @action+ filterByTargetUser(target_user, event) {+ event?.preventDefault();+ this.changeFilters({ target_user: target_user.username });+ },++ @action+ filterBySubject(subject, event) {+ event?.preventDefault();+ this.changeFilters({ subject });+ },++ @action+ exportStaffActionLogs() {+ exportEntity("staff_action").then(outputExportResult);+ },- loadMore() {- this.model.loadMore();- },+ @action+ 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.jsindex 71990f47a34..84b7650ff16 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,5 +1,6 @@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";@@ -43,6 +44,23 @@ 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();@@ -61,20 +79,5 @@ 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.jsindex 7ab4cb69848..8a60037a5ba 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,5 +1,6 @@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, {@@ -10,15 +11,17 @@ 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.hbsindex 31b16af4cc0..82492beecb4 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 @@</div>{{#if this.hasQuery}}- <a href {{action "preview" this.buffered "false"}}>{{i18n "admin.badges.preview.link_text"}}</a>+ <a href {{on "click" (fn this.showPreview this.buffered "false")}}>{{i18n "admin.badges.preview.link_text"}}</a>|- <a href {{action "preview" this.buffered "true"}}>{{i18n "admin.badges.preview.plan_text"}}</a>+ <a href {{on "click" (fn this.showPreview this.buffered "true")}}>{{i18n "admin.badges.preview.plan_text"}}</a>{{#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.hbsindex d62cfdbd783..998174f20a9 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}}<TextField @value={{this.buffer}} @autofocus="autofocus" @autocomplete="off" />{{else}}- <a href {{action "edit"}} class="inline-editable-field">+ <a href {{on "click" this.edit}} class="inline-editable-field"><span>{{this.value}}</span></a>{{/if}}@@ -11,7 +11,7 @@<div class="controls">{{#if this.editing}}<DButton @class="btn-default" @action={{action "save"}} @label="admin.user_fields.save" />- <a href {{action "edit"}}>{{i18n "cancel"}}</a>+ <a href {{on "click" this.edit}}>{{i18n "cancel"}}</a>{{else}}<DButton @class="btn-default" @action={{action "edit"}} @icon="pencil-alt" />{{/if}}diff --git a/app/assets/javascripts/admin/addon/templates/components/admin-theme-editor.hbs b/app/assets/javascripts/admin/addon/templates/components/admin-theme-editor.hbsindex ec8ed70f301..a8c33e1da26 100644--- a/app/assets/javascripts/admin/addon/templates/components/admin-theme-editor.hbs+++ b/app/assets/javascripts/admin/addon/templates/components/admin-theme-editor.hbs@@ -13,7 +13,7 @@{{#if this.allowAdvanced}}<li>- <a {{action "toggleShowAdvanced"}}+ <a {{on "click" this.toggleShowAdvanced}}hreftitle={{i18n (concat "admin.customize.theme." (if this.showAdvanced "hide_advanced" "show_advanced"))}}class="no-text">@@ -52,7 +52,7 @@<DButton @class="ok" @action={{action "addField" this.newFieldName}} @icon="check" /><DButton @class="cancel" @action={{action "cancelAddField"}} @icon="times" />{{else}}- <a href {{action "toggleAddField" this.currentTargetName}} class="no-text">+ <a href {{on "click" this.toggleAddField}} class="no-text">{{d-icon "plus"}}</a>{{/if}}@@ -61,7 +61,7 @@<li class="spacer"></li><li>- <a href {{action "toggleMaximize"}} class="no-text">+ <a href {{on "click" this.toggleMaximize}} class="no-text">{{d-icon this.maximizeIcon}}</a></li>diff --git a/app/assets/javascripts/admin/addon/templates/components/ip-lookup.hbs b/app/assets/javascripts/admin/addon/templates/components/ip-lookup.hbsindex f63ab16730a..31ec7f35a76 100644--- a/app/assets/javascripts/admin/addon/templates/components/ip-lookup.hbs+++ b/app/assets/javascripts/admin/addon/templates/components/ip-lookup.hbs@@ -3,7 +3,7 @@{{/if}}{{#if this.show}}<div class="location-box">- <a href class="close pull-right" {{action "hide"}}>{{d-icon "times"}}</a>+ <a href class="close pull-right" {{on "click" this.hide}}>{{d-icon "times"}}</a>{{#if this.copied}}<DButton @class="btn-hover pull-right" @icon="copy" @label="ip_lookup.copied" />{{else}}diff --git a/app/assets/javascripts/admin/addon/templates/components/themes-list-item.hbs b/app/assets/javascripts/admin/addon/templates/components/themes-list-item.hbsindex 1710a14454f..21678c1a436 100644--- a/app/assets/javascripts/admin/addon/templates/components/themes-list-item.hbs+++ b/app/assets/javascripts/admin/addon/templates/components/themes-list-item.hbs@@ -31,7 +31,7 @@<span class="components">{{html-safe this.childrenString}}</span>{{#if this.displayHasMore}}- <a href {{action "toggleChildrenExpanded"}} class="others-count">+ <a href {{on "click" this.toggleChildrenExpanded}} class="others-count">{{#if this.childrenExpanded}}{{i18n "admin.customize.theme.collapse"}}{{else}}diff --git a/app/assets/javascripts/admin/addon/templates/email-bounced.hbs b/app/assets/javascripts/admin/addon/templates/email-bounced.hbsindex cf6ceb81bc4..6a47751d00d 100644--- a/app/assets/javascripts/admin/addon/templates/email-bounced.hbs+++ b/app/assets/javascripts/admin/addon/templates/email-bounced.hbs@@ -30,7 +30,7 @@<td class="email-address"><a href="mailto:{{l.to_address}}">{{l.to_address}}</a></td><td>{{#if l.has_bounce_key}}- <a href {{action "showIncomingEmail" l.id}}>+ <a href {{on "click" (fn this.handleShowIncomingEmail l.id)}}>{{l.email_type}}</a>{{else}}@@ -39,7 +39,7 @@</td><td class="email-details">{{#if l.has_bounce_key}}- <a href {{action "showIncomingEmail" l.id}} title={{i18n "admin.email.details_title"}}>+ <a href {{on "click" (fn this.handleShowIncomingEmail l.id)}} title={{i18n "admin.email.details_title"}}>{{d-icon "info-circle"}}</a>{{/if}}diff --git a/app/assets/javascripts/admin/addon/templates/email-preview-digest.hbs b/app/assets/javascripts/admin/addon/templates/email-preview-digest.hbsindex d2ee4cad4d9..b00332840d5 100644--- a/app/assets/javascripts/admin/addon/templates/email-preview-digest.hbs+++ b/app/assets/javascripts/admin/addon/templates/email-preview-digest.hbs@@ -15,11 +15,11 @@{{#if this.showHtml}}<span>{{i18n "admin.email.html"}}</span>|- <a href {{action "toggleShowHtml"}}>+ <a href {{on "click" this.toggleShowHtml}}>{{i18n "admin.email.text"}}</a>{{else}}- <a href {{action "toggleShowHtml"}}>{{i18n "admin.email.html"}}</a> |+ <a href {{on "click" this.toggleShowHtml}}>{{i18n "admin.email.html"}}</a> |<span>{{i18n "admin.email.text"}}</span>{{/if}}</div>diff --git a/app/assets/javascripts/admin/addon/templates/email-rejected.hbs b/app/assets/javascripts/admin/addon/templates/email-rejected.hbsindex 21dcbba21da..19033f5f6f9 100644--- a/app/assets/javascripts/admin/addon/templates/email-rejected.hbs+++ b/app/assets/javascripts/admin/addon/templates/email-rejected.hbs@@ -48,10 +48,10 @@</td><td>{{email.subject}}</td><td class="error">- <a href {{action "showIncomingEmail" email.id}}>{{email.error}}</a>+ <a href {{on "click" (fn this.handleShowIncomingEmail email.id)}}>{{email.error}}</a></td><td class="email-details">- <a href {{action "showIncomingEmail" email.id}} title={{i18n "admin.email.details_title"}}>+ <a href {{on "click" (fn this.handleShowIncomingEmail email.id)}} title={{i18n "admin.email.details_title"}}>{{d-icon "info-circle"}}</a></td>diff --git a/app/assets/javascripts/admin/addon/templates/logs/screened-ip-addresses.hbs b/app/assets/javascripts/admin/addon/templates/logs/screened-ip-addresses.hbsindex 63489dcdee9..ab20b2316b6 100644--- a/app/assets/javascripts/admin/addon/templates/logs/screened-ip-addresses.hbs+++ b/app/assets/javascripts/admin/addon/templates/logs/screened-ip-addresses.hbs@@ -27,7 +27,7 @@{{#if item.editing}}<TextField @value={{item.ip_address}} @autofocus="autofocus" />{{else}}- <a href {{action "edit" item}} class="inline-editable-field">+ <a href {{on "click" (fn this.edit item)}} class="inline-editable-field">{{#if item.isRange}}<strong>{{item.ip_address}}</strong>{{else}}diff --git a/app/assets/javascripts/admin/addon/templates/logs/staff-action-logs.hbs b/app/assets/javascripts/admin/addon/templates/logs/staff-action-logs.hbsindex bcee25b4396..d2e46867c94 100644--- a/app/assets/javascripts/admin/addon/templates/logs/staff-action-logs.hbs+++ b/app/assets/javascripts/admin/addon/templates/logs/staff-action-logs.hbs@@ -1,29 +1,29 @@<div class="staff-action-logs-controls">{{#if this.filtersExists}}<div class="staff-action-logs-filters">- <a href {{action "clearAllFilters"}} class="clear-filters filter btn">+ <a href {{on "click" this.clearAllFilters}} class="clear-filters filter btn"><span class="label">{{i18n "admin.logs.staff_actions.clear_filters"}}</span></a>{{#if this.actionFilter}}- <a href {{action "clearFilter" "actionFilter"}} class="filter btn">+ <a href {{on "click" (fn this.clearFilter "actionFilter")}} class="filter btn"><span class="label">{{i18n "admin.logs.action"}}</span>: {{this.actionFilter}}{{d-icon "times-circle"}}</a>{{/if}}{{#if this.filters.acting_user}}- <a href {{action "clearFilter" "acting_user"}} class="filter btn">+ <a href {{on "click" (fn this.clearFilter "acting_user")}} class="filter btn"><span class="label">{{i18n "admin.logs.staff_actions.staff_user"}}</span>: {{this.filters.acting_user}}{{d-icon "times-circle"}}</a>{{/if}}{{#if this.filters.target_user}}- <a href {{action "clearFilter" "target_user"}} class="filter btn">+ <a href {{on "click" (fn this.clearFilter "target_user")}} class="filter btn"><span class="label">{{i18n "admin.logs.staff_actions.target_user"}}</span>: {{this.filters.target_user}}{{d-icon "times-circle"}}</a>{{/if}}{{#if this.filters.subject}}- <a href {{action "clearFilter" "subject"}} class="filter btn">+ <a href {{on "click" (fn this.clearFilter "subject")}} class="filter btn"><span class="label">{{i18n "admin.logs.staff_actions.subject"}}</span>: {{this.filters.subject}}{{d-icon "times-circle"}}</a>@@ -71,16 +71,16 @@</div></td><td class="col value action">- <a href {{action "filterByAction" item}}>{{item.actionName}}</a>+ <a href {{on "click" (fn this.filterByAction item)}}>{{item.actionName}}</a></td><td class="col value subject"><div class="subject">{{#if item.target_user}}<LinkTo @route="adminUser" @model={{item.target_user}}>{{avatar item.target_user imageSize="tiny"}}</LinkTo>- <a href {{action "filterByTargetUser" item.target_user}}>{{item.target_user.username}}</a>+ <a href {{on "click" (fn this.filterByTargetUser item.target_user)}}>{{item.target_user.username}}</a>{{/if}}{{#if item.subject}}- <a href {{action "filterBySubject" item.subject}} title={{item.subject}}>{{item.subject}}</a>+ <a href {{on "click" (fn this.filterBySubject item.subject)}} title={{item.subject}}>{{item.subject}}</a>{{/if}}</div></td>@@ -89,10 +89,10 @@<div>{{html-safe item.formattedDetails}}{{#if item.useCustomModalForDetails}}- <a href {{action "showCustomDetailsModal" item}}>{{d-icon "info-circle"}} {{i18n "admin.logs.staff_actions.show"}}</a>+ <a href {{on "click" (fn this.showCustomDetailsModal item)}}>{{d-icon "info-circle"}} {{i18n "admin.logs.staff_actions.show"}}</a>{{/if}}{{#if item.useModalForDetails}}- <a href {{action "showDetailsModal" item}}>{{d-icon "info-circle"}} {{i18n "admin.logs.staff_actions.show"}}</a>+ <a href {{on "click" (fn this.showDetailsModal item)}}>{{d-icon "info-circle"}} {{i18n "admin.logs.staff_actions.show"}}</a>{{/if}}</div></td>diff --git a/app/assets/javascripts/admin/addon/templates/modal/admin-uploaded-image-list.hbs b/app/assets/javascripts/admin/addon/templates/modal/admin-uploaded-image-list.hbsindex a7aefa73714..aca6fef6f47 100644--- a/app/assets/javascripts/admin/addon/templates/modal/admin-uploaded-image-list.hbs+++ b/app/assets/javascripts/admin/addon/templates/modal/admin-uploaded-image-list.hbs@@ -1,7 +1,7 @@<DModalBody @class="uploaded-image-list"><div class="selectable-avatars">{{#each this.images as |image|}}- <a href class="selectable-avatar" {{action "remove" image}}>+ <a href class="selectable-avatar" {{on "click" (fn this.remove image)}}>{{bound-avatar-template image "huge"}}</a>{{else}}diff --git a/app/assets/javascripts/admin/addon/templates/web-hooks-show-events.hbs b/app/assets/javascripts/admin/addon/templates/web-hooks-show-events.hbsindex 2b5c768def3..c9791f0fc4f 100644--- a/app/assets/javascripts/admin/addon/templates/web-hooks-show-events.hbs+++ b/app/assets/javascripts/admin/addon/templates/web-hooks-show-events.hbs@@ -21,7 +21,7 @@<div class="clearfix"></div></div>{{#if this.hasIncoming}}- <a href tabindex="0" {{action "showInserted"}} class="alert alert-info clickable">+ <a href tabindex="0" {{on "click" this.showInserted}} class="alert alert-info clickable"><CountI18n @key="admin.web_hooks.events.incoming" @count={{this.incomingCount}} /></a>{{/if}}diff --git a/app/assets/javascripts/discourse/app/components/categories-only.js b/app/assets/javascripts/discourse/app/components/categories-only.jsindex 002ddf82e3e..d480f464555 100644--- a/app/assets/javascripts/discourse/app/components/categories-only.js+++ b/app/assets/javascripts/discourse/app/components/categories-only.js@@ -50,7 +50,8 @@ export default Component.extend({},@action- toggleShowMuted() {+ toggleShowMuted(event) {+ event?.preventDefault();this.toggleProperty("showMuted");},});diff --git a/app/assets/javascripts/discourse/app/components/category-permission-row.js b/app/assets/javascripts/discourse/app/components/category-permission-row.jsindex 2e41aa6e63c..46eb3690f97 100644--- a/app/assets/javascripts/discourse/app/components/category-permission-row.js+++ b/app/assets/javascripts/discourse/app/components/category-permission-row.js@@ -1,3 +1,4 @@+import { action } from "@ember/object";import { alias, equal } from "@ember/object/computed";import discourseComputed, { observes } from "discourse-common/utils/decorators";import Component from "@ember/component";@@ -92,11 +93,13 @@ export default Component.extend({this.category.updatePermission(this.group_name, type);},- actions: {- removeRow() {- this.category.removePermission(this.group_name);- },+ @action+ removeRow(event) {+ event?.preventDefault();+ this.category.removePermission(this.group_name);+ },+ actions: {setPermissionReply() {if (this.type <= PermissionType.CREATE_POST) {this.updatePermission(PermissionType.READONLY);diff --git a/app/assets/javascripts/discourse/app/components/choose-message.js b/app/assets/javascripts/discourse/app/components/choose-message.jsindex 09d9a9123cb..15f0424f60e 100644--- a/app/assets/javascripts/discourse/app/components/choose-message.js+++ b/app/assets/javascripts/discourse/app/components/choose-message.js@@ -1,6 +1,6 @@import Component from "@ember/component";import discourseDebounce from "discourse-common/lib/debounce";-import { get } from "@ember/object";+import { action, get } from "@ember/object";import { isEmpty } from "@ember/utils";import { next } from "@ember/runloop";import { observes } from "discourse-common/utils/decorators";@@ -63,12 +63,11 @@ export default Component.extend({);},- actions: {- chooseMessage(message) {- const messageId = get(message, "id");- this.set("selectedTopicId", messageId);- next(() => $(`#choose-message-${messageId}`).prop("checked", "true"));- return false;- },+ @action+ chooseMessage(message, event) {+ event?.preventDefault();+ const messageId = get(message, "id");+ this.set("selectedTopicId", messageId);+ next(() => $(`#choose-message-${messageId}`).prop("checked", "true"));},});diff --git a/app/assets/javascripts/discourse/app/components/composer-messages.js b/app/assets/javascripts/discourse/app/components/composer-messages.jsindex 40832b5df17..275d1c534c5 100644--- a/app/assets/javascripts/discourse/app/components/composer-messages.js+++ b/app/assets/javascripts/discourse/app/components/composer-messages.js@@ -1,5 +1,5 @@import Component from "@ember/component";-import EmberObject from "@ember/object";+import EmberObject, { action } from "@ember/object";import I18n from "I18n";import LinkLookup from "discourse/lib/link-lookup";import { not } from "@ember/object/computed";@@ -54,11 +54,13 @@ export default Component.extend({this.set("messageCount", messages.get("length"));},- actions: {- closeMessage(message) {- this._removeMessage(message);- },+ @action+ closeMessage(message, event) {+ event?.preventDefault();+ this._removeMessage(message);+ },+ actions: {hideMessage(message) {this._removeMessage(message);// kind of hacky but the visibility depends on thisdiff --git a/app/assets/javascripts/discourse/app/components/edit-category-tab.js b/app/assets/javascripts/discourse/app/components/edit-category-tab.jsindex e96720db36d..5619e8c7531 100644--- a/app/assets/javascripts/discourse/app/components/edit-category-tab.js+++ b/app/assets/javascripts/discourse/app/components/edit-category-tab.js@@ -2,6 +2,7 @@ import Component from "@ember/component";import DiscourseURL from "discourse/lib/url";import I18n from "I18n";import discourseComputed from "discourse-common/utils/decorators";+import { action } from "@ember/object";import { empty } from "@ember/object/computed";import getURL from "discourse-common/lib/get-url";import { propertyEqual } from "discourse/lib/computed";@@ -49,13 +50,12 @@ export default Component.extend({return getURL(`/c/${slugPart}/edit/${this.tab}`);},- actions: {- select() {- this.set("selectedTab", this.tab);-- if (!this.newCategory) {- DiscourseURL.routeTo(this.fullSlug);- }- },+ @action+ select(event) {+ event?.preventDefault();+ this.set("selectedTab", this.tab);+ if (!this.newCategory) {+ DiscourseURL.routeTo(this.fullSlug);+ }},});diff --git a/app/assets/javascripts/discourse/app/components/emoji-picker.js b/app/assets/javascripts/discourse/app/components/emoji-picker.jsindex 3e0646f8939..8a5dec83a65 100644--- a/app/assets/javascripts/discourse/app/components/emoji-picker.js+++ b/app/assets/javascripts/discourse/app/components/emoji-picker.js@@ -240,7 +240,8 @@ export default Component.extend({},@action- onCategorySelection(sectionName) {+ onCategorySelection(sectionName, event) {+ event?.preventDefault();const section = document.querySelector(`.emoji-picker-emoji-area .section[data-section="${sectionName}"]`);diff --git a/app/assets/javascripts/discourse/app/components/group-card-contents.js b/app/assets/javascripts/discourse/app/components/group-card-contents.jsindex cb073a6733d..547840d197c 100644--- a/app/assets/javascripts/discourse/app/components/group-card-contents.js+++ b/app/assets/javascripts/discourse/app/components/group-card-contents.js@@ -1,3 +1,4 @@+import { action } from "@ember/object";import { alias, gt } from "@ember/object/computed";import CardContentsBase from "discourse/mixins/card-contents-base";import CleansUp from "discourse/mixins/cleans-up";@@ -6,6 +7,7 @@ import { Promise } from "rsvp";import discourseComputed from "discourse-common/utils/decorators";import { groupPath } from "discourse/lib/url";import { setting } from "discourse/lib/computed";+import { modKeysPressed } from "discourse/lib/utilities";const maxMembersToDisplay = 10;@@ -70,11 +72,25 @@ export default Component.extend(CardContentsBase, CleansUp, {this._close();},- actions: {- close() {- this._close();- },+ @action+ close(event) {+ event?.preventDefault();+ this._close();+ },+ @action+ handleShowGroup(group, event) {+ if (event && modKeysPressed(event).length > 0) {+ return false;+ }+ event?.preventDefault();+ // Invokes `showGroup` argument. Convert to `this.args.showGroup` when+ // refactoring this to a glimmer component.+ this.showGroup(group);+ this._close();+ },++ actions: {cancelFilter() {const postStream = this.postStream;postStream.cancelFilter();@@ -90,8 +106,7 @@ export default Component.extend(CardContentsBase, CleansUp, {},showGroup(group) {- this.showGroup(group);- this._close();+ this.handleShowGroup(group);},},});diff --git a/app/assets/javascripts/discourse/app/components/group-imap-email-settings.js b/app/assets/javascripts/discourse/app/components/group-imap-email-settings.jsindex 190a9fb2f97..a437f42d445 100644--- a/app/assets/javascripts/discourse/app/components/group-imap-email-settings.js+++ b/app/assets/javascripts/discourse/app/components/group-imap-email-settings.js@@ -53,7 +53,8 @@ export default Component.extend({},@action- prefillSettings(provider) {+ prefillSettings(provider, event) {+ event?.preventDefault();this.form.setProperties(emailProviderDefaultSettings(provider, "imap"));},diff --git a/app/assets/javascripts/discourse/app/components/group-member.js b/app/assets/javascripts/discourse/app/components/group-member.jsindex 64b2570dee2..08d1097b426 100644--- a/app/assets/javascripts/discourse/app/components/group-member.js+++ b/app/assets/javascripts/discourse/app/components/group-member.js@@ -1,10 +1,12 @@import Component from "@ember/component";+import { action } from "@ember/object";+export default Component.extend({classNames: ["item"],- actions: {- remove() {- this.removeAction(this.member);- },+ @action+ remove(event) {+ event?.preventDefault();+ this.removeAction(this.member);},});diff --git a/app/assets/javascripts/discourse/app/components/group-smtp-email-settings.js b/app/assets/javascripts/discourse/app/components/group-smtp-email-settings.jsindex 5456c75a792..d4b4bcb9de4 100644--- a/app/assets/javascripts/discourse/app/components/group-smtp-email-settings.js+++ b/app/assets/javascripts/discourse/app/components/group-smtp-email-settings.js@@ -43,7 +43,8 @@ export default Component.extend({},@action- prefillSettings(provider) {+ prefillSettings(provider, event) {+ event?.preventDefault();this.form.setProperties(emailProviderDefaultSettings(provider, "smtp"));},diff --git a/app/assets/javascripts/discourse/app/components/mobile-nav.js b/app/assets/javascripts/discourse/app/components/mobile-nav.jsindex bdbb2cc85a2..f0ea3e6138d 100644--- a/app/assets/javascripts/discourse/app/components/mobile-nav.js+++ b/app/assets/javascripts/discourse/app/components/mobile-nav.js@@ -1,5 +1,6 @@import { on } from "discourse-common/utils/decorators";import Component from "@ember/component";+import { action } from "@ember/object";import { next } from "@ember/runloop";import { inject as service } from "@ember/service";import deprecated from "discourse-common/lib/deprecated";@@ -56,27 +57,27 @@ export default Component.extend({this.router.off("routeDidChange", this, this.currentRouteChanged);},- actions: {- toggleExpanded() {- this.toggleProperty("expanded");+ @action+ toggleExpanded(event) {+ event?.preventDefault();+ this.toggleProperty("expanded");- next(() => {- if (this.expanded) {- $(window)- .off("click.mobile-nav")- .on("click.mobile-nav", (e) => {- if (!this.element || this.isDestroying || this.isDestroyed) {- return;- }+ next(() => {+ if (this.expanded) {+ $(window)+ .off("click.mobile-nav")+ .on("click.mobile-nav", (e) => {+ if (!this.element || this.isDestroying || this.isDestroyed) {+ return;+ }- const expander = this.element.querySelector(".expander");- if (expander && e.target !== expander) {- this.set("expanded", false);- $(window).off("click.mobile-nav");- }- });- }- });- },+ const expander = this.element.querySelector(".expander");+ if (expander && e.target !== expander) {+ this.set("expanded", false);+ $(window).off("click.mobile-nav");+ }+ });+ }+ });},});diff --git a/app/assets/javascripts/discourse/app/components/navigation-bar.js b/app/assets/javascripts/discourse/app/components/navigation-bar.jsindex ab9a5b9c714..5ede7b2bf4c 100644--- a/app/assets/javascripts/discourse/app/components/navigation-bar.js+++ b/app/assets/javascripts/discourse/app/components/navigation-bar.js@@ -1,5 +1,6 @@import discourseComputed, { observes } from "discourse-common/utils/decorators";import Component from "@ember/component";+import { action } from "@ember/object";import DiscourseURL from "discourse/lib/url";import FilterModeMixin from "discourse/mixins/filter-mode";import { next } from "@ember/runloop";@@ -61,33 +62,33 @@ export default Component.extend(FilterModeMixin, {DiscourseURL.appEvents.off("dom:clean", this, this.ensureDropClosed);},- actions: {- toggleDrop() {- this.set("expanded", !this.expanded);+ @action+ toggleDrop(event) {+ event?.preventDefault();+ this.set("expanded", !this.expanded);- if (this.expanded) {- DiscourseURL.appEvents.on("dom:clean", this, this.ensureDropClosed);-- next(() => {- if (!this.expanded) {- return;- }+ if (this.expanded) {+ DiscourseURL.appEvents.on("dom:clean", this, this.ensureDropClosed);- $(this.element.querySelector(".drop a")).on("click", () => {- this.element.querySelector(".drop").style.display = "none";+ next(() => {+ if (!this.expanded) {+ return;+ }- next(() => {- this.ensureDropClosed();- });- return true;- });+ $(this.element.querySelector(".drop a")).on("click", () => {+ this.element.querySelector(".drop").style.display = "none";- $(window).on("click.navigation-bar", () => {+ next(() => {this.ensureDropClosed();- return true;});+ return true;});- }- },++ $(window).on("click.navigation-bar", () => {+ this.ensureDropClosed();+ return true;+ });+ });+ }},});diff --git a/app/assets/javascripts/discourse/app/components/reviewable-item.js b/app/assets/javascripts/discourse/app/components/reviewable-item.jsindex ff67e672a81..73c90d665a9 100644--- a/app/assets/javascripts/discourse/app/components/reviewable-item.js+++ b/app/assets/javascripts/discourse/app/components/reviewable-item.js@@ -7,7 +7,7 @@ import { classify, dasherize } from "@ember/string";import discourseComputed, { bind } from "discourse-common/utils/decorators";import optionalService from "discourse/lib/optional-service";import { popupAjaxError } from "discourse/lib/ajax-error";-import { set } from "@ember/object";+import { action, set } from "@ember/object";import showModal from "discourse/lib/show-modal";let _components = {};@@ -121,7 +121,7 @@ export default Component.extend({},@bind- _performConfirmed(action) {+ _performConfirmed(performableAction) {let reviewable = this.reviewable;let performAction = () => {@@ -140,7 +140,7 @@ export default Component.extend({});return ajax(- `/review/${reviewable.id}/perform/${action.id}?version=${version}`,+ `/review/${reviewable.id}/perform/${performableAction.id}?version=${version}`,{type: "PUT",data,@@ -173,13 +173,16 @@ export default Component.extend({.finally(() => this.set("updating", false));};- if (action.client_action) {- let actionMethod = this[`client${classify(action.client_action)}`];+ if (performableAction.client_action) {+ let actionMethod =+ this[`client${classify(performableAction.client_action)}`];if (actionMethod) {return actionMethod.call(this, reviewable, performAction);} else {// eslint-disable-next-line no-console- console.error(`No handler for ${action.client_action} found`);+ console.error(+ `No handler for ${performableAction.client_action} found`+ );return;}} else {@@ -209,14 +212,16 @@ export default Component.extend({}},- actions: {- explainReviewable(reviewable) {- showModal("explain-reviewable", {- title: "review.explain.title",- model: reviewable,- });- },+ @action+ explainReviewable(reviewable, event) {+ event?.preventDefault();+ showModal("explain-reviewable", {+ title: "review.explain.title",+ model: reviewable,+ });+ },+ actions: {edit() {this.set("editing", true);this.set("_updates", { payload: {} });@@ -259,18 +264,18 @@ export default Component.extend({set(this._updates, fieldId, event.target.value);},- perform(action) {+ perform(performableAction) {if (this.updating) {return;}- let msg = action.get("confirm_message");- let requireRejectReason = action.get("require_reject_reason");- let customModal = action.get("custom_modal");+ let msg = performableAction.get("confirm_message");+ let requireRejectReason = performableAction.get("require_reject_reason");+ let customModal = performableAction.get("custom_modal");if (msg) {bootbox.confirm(msg, (answer) => {if (answer) {- return this._performConfirmed(action);+ return this._performConfirmed(performableAction);}});} else if (requireRejectReason) {@@ -279,7 +284,7 @@ export default Component.extend({model: this.reviewable,}).setProperties({performConfirmed: this._performConfirmed,- action,+ action: performableAction,});} else if (customModal) {showModal(customModal, {@@ -287,10 +292,10 @@ export default Component.extend({model: this.reviewable,}).setProperties({performConfirmed: this._performConfirmed,- action,+ action: performableAction,});} else {- return this._performConfirmed(action);+ return this._performConfirmed(performableAction);}},},diff --git a/app/assets/javascripts/discourse/app/components/reviewable-post-edits.js b/app/assets/javascripts/discourse/app/components/reviewable-post-edits.jsindex 84c27f152f5..75b8692a49f 100644--- a/app/assets/javascripts/discourse/app/components/reviewable-post-edits.js+++ b/app/assets/javascripts/discourse/app/components/reviewable-post-edits.js@@ -1,5 +1,6 @@import Component from "@ember/component";import discourseComputed from "discourse-common/utils/decorators";+import { action } from "@ember/object";import { gt } from "@ember/object/computed";import { historyHeat } from "discourse/widgets/post-edits-indicator";import { longDate } from "discourse/lib/formatter";@@ -18,18 +19,18 @@ export default Component.extend({return longDate(updatedAt);},- actions: {- showEditHistory() {- let postId = this.get("reviewable.post_id");- this.store.find("post", postId).then((post) => {- let historyController = showModal("history", {- model: post,- modalClass: "history-modal",- });- historyController.refresh(postId, "latest");- historyController.set("post", post);- historyController.set("topicController", null);+ @action+ showEditHistory(event) {+ event?.preventDefault();+ let postId = this.get("reviewable.post_id");+ this.store.find("post", postId).then((post) => {+ let historyController = showModal("history", {+ model: post,+ modalClass: "history-modal",});- },+ historyController.refresh(postId, "latest");+ historyController.set("post", post);+ historyController.set("topicController", null);+ });},});diff --git a/app/assets/javascripts/discourse/app/components/reviewable-queued-post.js b/app/assets/javascripts/discourse/app/components/reviewable-queued-post.jsindex e40ab39ef7d..d06ddf3c1c5 100644--- a/app/assets/javascripts/discourse/app/components/reviewable-queued-post.js+++ b/app/assets/javascripts/discourse/app/components/reviewable-queued-post.js@@ -1,10 +1,11 @@import Component from "@ember/component";+import { action } from "@ember/object";import showModal from "discourse/lib/show-modal";export default Component.extend({- actions: {- showRawEmail() {- showModal("raw-email").set("rawEmail", this.reviewable.payload.raw_email);- },+ @action+ showRawEmail(event) {+ event?.preventDefault();+ showModal("raw-email").set("rawEmail", this.reviewable.payload.raw_email);},});diff --git a/app/assets/javascripts/discourse/app/components/search-result-entry.js b/app/assets/javascripts/discourse/app/components/search-result-entry.jsindex 9312174ed18..cf13405a657 100644--- a/app/assets/javascripts/discourse/app/components/search-result-entry.js+++ b/app/assets/javascripts/discourse/app/components/search-result-entry.js@@ -1,6 +1,7 @@import Component from "@ember/component";import { action } from "@ember/object";import { logSearchLinkClick } from "discourse/lib/search";+import { modKeysPressed } from "discourse/lib/utilities";export default Component.extend({tagName: "div",@@ -10,7 +11,11 @@ export default Component.extend({role: "listitem",@action- logClick(topicId) {+ logClick(topicId, event) {+ // Avoid click logging when any modifier keys are pressed.+ if (event && modKeysPressed(event).length > 0) {+ return false;+ }if (this.searchLogId && topicId) {logSearchLinkClick({searchLogId: this.searchLogId,diff --git a/app/assets/javascripts/discourse/app/components/second-factor-form.js b/app/assets/javascripts/discourse/app/components/second-factor-form.jsindex 3f0c40b381e..e208a5f3145 100644--- a/app/assets/javascripts/discourse/app/components/second-factor-form.js+++ b/app/assets/javascripts/discourse/app/components/second-factor-form.js@@ -1,4 +1,5 @@import Component from "@ember/component";+import { action } from "@ember/object";import I18n from "I18n";import { SECOND_FACTOR_METHODS } from "discourse/models/user";import discourseComputed from "discourse-common/utils/decorators";@@ -48,15 +49,15 @@ export default Component.extend({);},- actions: {- toggleSecondFactorMethod() {- const secondFactorMethod = this.secondFactorMethod;- this.set("secondFactorToken", "");- if (secondFactorMethod === SECOND_FACTOR_METHODS.TOTP) {- this.set("secondFactorMethod", SECOND_FACTOR_METHODS.BACKUP_CODE);- } else {- this.set("secondFactorMethod", SECOND_FACTOR_METHODS.TOTP);- }- },+ @action+ toggleSecondFactorMethod(event) {+ event?.preventDefault();+ const secondFactorMethod = this.secondFactorMethod;+ this.set("secondFactorToken", "");+ if (secondFactorMethod === SECOND_FACTOR_METHODS.TOTP) {+ this.set("secondFactorMethod", SECOND_FACTOR_METHODS.BACKUP_CODE);+ } else {+ this.set("secondFactorMethod", SECOND_FACTOR_METHODS.TOTP);+ }},});diff --git a/app/assets/javascripts/discourse/app/components/security-key-form.js b/app/assets/javascripts/discourse/app/components/security-key-form.jsindex bd6d03f9f4e..dcc0725113f 100644--- a/app/assets/javascripts/discourse/app/components/security-key-form.js+++ b/app/assets/javascripts/discourse/app/components/security-key-form.js@@ -1,12 +1,13 @@import Component from "@ember/component";+import { action } from "@ember/object";import { SECOND_FACTOR_METHODS } from "discourse/models/user";export default Component.extend({- actions: {- useAnotherMethod() {- this.set("showSecurityKey", false);- this.set("showSecondFactor", true);- this.set("secondFactorMethod", SECOND_FACTOR_METHODS.TOTP);- },+ @action+ useAnotherMethod(event) {+ event?.preventDefault();+ this.set("showSecurityKey", false);+ this.set("showSecondFactor", true);+ this.set("secondFactorMethod", SECOND_FACTOR_METHODS.TOTP);},});diff --git a/app/assets/javascripts/discourse/app/components/signup-cta.js b/app/assets/javascripts/discourse/app/components/signup-cta.jsindex 5ea99dffe9b..a4d80fd611d 100644--- a/app/assets/javascripts/discourse/app/components/signup-cta.js+++ b/app/assets/javascripts/discourse/app/components/signup-cta.js@@ -1,15 +1,19 @@import Component from "@ember/component";import discourseLater from "discourse-common/lib/later";+import { action } from "@ember/object";import { on } from "@ember/object/evented";export default Component.extend({action: "showCreateAccount",+ @action+ neverShow(event) {+ event?.preventDefault();+ this.keyValueStore.setItem("anon-cta-never", "t");+ this.session.set("showSignupCta", false);+ },+actions: {- neverShow() {- this.keyValueStore.setItem("anon-cta-never", "t");- this.session.set("showSignupCta", false);- },hideForSession() {this.session.set("hideSignupCta", true);this.keyValueStore.setItem("anon-cta-hidden", Date.now());diff --git a/app/assets/javascripts/discourse/app/components/tag-info.js b/app/assets/javascripts/discourse/app/components/tag-info.jsindex 6cb2a35dba8..21da9a92f1b 100644--- a/app/assets/javascripts/discourse/app/components/tag-info.js+++ b/app/assets/javascripts/discourse/app/components/tag-info.js@@ -7,6 +7,7 @@ import discourseComputed from "discourse-common/utils/decorators";import { isEmpty } from "@ember/utils";import { popupAjaxError } from "discourse/lib/ajax-error";import { inject as service } from "@ember/service";+import { action } from "@ember/object";export default Component.extend({dialog: service(),@@ -76,19 +77,49 @@ export default Component.extend({.catch(popupAjaxError);},+ @action+ edit(event) {+ event?.preventDefault();+ this.setProperties({+ editing: true,+ newTagName: this.tag.id,+ newTagDescription: this.tagInfo.description,+ });+ },++ @action+ unlinkSynonym(tag, event) {+ event?.preventDefault();+ ajax(`/tag/${this.tagInfo.name}/synonyms/${tag.id}`, {+ type: "DELETE",+ })+ .then(() => this.tagInfo.synonyms.removeObject(tag))+ .catch(popupAjaxError);+ },++ @action+ deleteSynonym(tag, event) {+ event?.preventDefault();+ bootbox.confirm(+ I18n.t("tagging.delete_synonym_confirm", { tag_name: tag.text }),+ (result) => {+ if (!result) {+ return;+ }++ tag+ .destroyRecord()+ .then(() => this.tagInfo.synonyms.removeObject(tag))+ .catch(popupAjaxError);+ }+ );+ },+actions: {toggleEditControls() {this.toggleProperty("showEditControls");},- edit() {- this.setProperties({- editing: true,- newTagName: this.tag.id,- newTagDescription: this.tagInfo.description,- });- },-cancelEditing() {this.set("editing", false);},@@ -114,30 +145,6 @@ export default Component.extend({this.deleteAction(this.tagInfo);},- unlinkSynonym(tag) {- ajax(`/tag/${this.tagInfo.name}/synonyms/${tag.id}`, {- type: "DELETE",- })- .then(() => this.tagInfo.synonyms.removeObject(tag))- .catch(popupAjaxError);- },-- deleteSynonym(tag) {- bootbox.confirm(- I18n.t("tagging.delete_synonym_confirm", { tag_name: tag.text }),- (result) => {- if (!result) {- return;- }-- tag- .destroyRecord()- .then(() => this.tagInfo.synonyms.removeObject(tag))- .catch(popupAjaxError);- }- );- },-addSynonyms() {bootbox.confirm(I18n.t("tagging.add_synonyms_explanation", {diff --git a/app/assets/javascripts/discourse/app/components/topic-list-item.js b/app/assets/javascripts/discourse/app/components/topic-list-item.jsindex 972e8241732..2d6ce3e18fd 100644--- a/app/assets/javascripts/discourse/app/components/topic-list-item.js+++ b/app/assets/javascripts/discourse/app/components/topic-list-item.js@@ -251,6 +251,7 @@ export default Component.extend({if (wantsNewWindow(e)) {return true;}+ e.preventDefault();return this.navigateToTopic(topic, e.target.getAttribute("href"));}@@ -264,6 +265,7 @@ export default Component.extend({if (wantsNewWindow(e)) {return true;}+ e.preventDefault();return this.navigateToTopic(topic, topic.lastUnreadUrl);}diff --git a/app/assets/javascripts/discourse/app/components/user-card-contents.js b/app/assets/javascripts/discourse/app/components/user-card-contents.jsindex 930f77a8c14..34e3147745f 100644--- a/app/assets/javascripts/discourse/app/components/user-card-contents.js+++ b/app/assets/javascripts/discourse/app/components/user-card-contents.js@@ -1,4 +1,4 @@-import EmberObject, { set } from "@ember/object";+import EmberObject, { action, set } from "@ember/object";import { alias, and, gt, gte, not, or } from "@ember/object/computed";import discourseComputed, { observes } from "discourse-common/utils/decorators";import { propertyNotEqual, setting } from "discourse/lib/computed";@@ -14,7 +14,7 @@ import { isEmpty } from "@ember/utils";import { prioritizeNameInUx } from "discourse/lib/settings";import { dasherize } from "@ember/string";import { emojiUnescape } from "discourse/lib/text";-import { escapeExpression } from "discourse/lib/utilities";+import { escapeExpression, modKeysPressed } from "discourse/lib/utilities";export default Component.extend(CardContentsBase, CanCheckEmails, CleansUp, {elementId: "user-card",@@ -220,6 +220,18 @@ export default Component.extend(CardContentsBase, CanCheckEmails, CleansUp, {this._close();},+ @action+ handleShowUser(user, event) {+ if (event && modKeysPressed(event).length > 0) {+ return false;+ }+ event?.preventDefault();+ // Invokes `showUser` argument. Convert to `this.args.showUser` when+ // refactoring this to a glimmer component.+ this.showUser(user);+ this._close();+ },+actions: {close() {this._close();@@ -247,9 +259,8 @@ export default Component.extend(CardContentsBase, CanCheckEmails, CleansUp, {this._close();},- showUser(username) {- this.showUser(username);- this._close();+ showUser(user) {+ this.handleShowUser(user);},checkEmail(user) {diff --git a/app/assets/javascripts/discourse/app/controllers/auth-token.js b/app/assets/javascripts/discourse/app/controllers/auth-token.jsindex 2d8c91157a3..52ddce5f4de 100644--- a/app/assets/javascripts/discourse/app/controllers/auth-token.js+++ b/app/assets/javascripts/discourse/app/controllers/auth-token.js@@ -1,6 +1,7 @@import Controller from "@ember/controller";import ModalFunctionality from "discourse/mixins/modal-functionality";import { ajax } from "discourse/lib/ajax";+import { action } from "@ember/object";import { next } from "@ember/runloop";import { userPath } from "discourse/lib/url";@@ -17,11 +18,13 @@ export default Controller.extend(ModalFunctionality, {});},- actions: {- toggleExpanded() {- this.set("expanded", !this.expanded);- },+ @action+ toggleExpanded(event) {+ event?.preventDefault();+ this.set("expanded", !this.expanded);+ },+ actions: {highlightSecure() {this.send("closeModal");diff --git a/app/assets/javascripts/discourse/app/controllers/avatar-selector.js b/app/assets/javascripts/discourse/app/controllers/avatar-selector.jsindex 8373b7a106d..d63f464c2a6 100644--- a/app/assets/javascripts/discourse/app/controllers/avatar-selector.js+++ b/app/assets/javascripts/discourse/app/controllers/avatar-selector.js@@ -1,4 +1,5 @@import Controller from "@ember/controller";+import { action } from "@ember/object";import ModalFunctionality from "discourse/mixins/modal-functionality";import { ajax } from "discourse/lib/ajax";import { allowsImages } from "discourse/lib/uploads";@@ -132,6 +133,15 @@ export default Controller.extend(ModalFunctionality, {);},+ @action+ selectAvatar(url, event) {+ event?.preventDefault();+ this.user+ .selectAvatar(url)+ .then(() => window.location.reload())+ .catch(popupAjaxError);+ },+actions: {uploadComplete() {this.set("selected", "custom");@@ -159,13 +169,6 @@ export default Controller.extend(ModalFunctionality, {.finally(() => this.set("gravatarRefreshDisabled", false));},- selectAvatar(url) {- this.user- .selectAvatar(url)- .then(() => window.location.reload())- .catch(popupAjaxError);- },-saveAvatarSelection() {const selectedUploadId = this.selectedUploadId;const type = this.selected;diff --git a/app/assets/javascripts/discourse/app/controllers/composer.js b/app/assets/javascripts/discourse/app/controllers/composer.jsindex 3463f6f1d77..a25874f18d0 100644--- a/app/assets/javascripts/discourse/app/controllers/composer.js+++ b/app/assets/javascripts/discourse/app/controllers/composer.js@@ -23,7 +23,7 @@ import { buildQuote } from "discourse/lib/quote";import deprecated from "discourse-common/lib/deprecated";import discourseDebounce from "discourse-common/lib/debounce";import { emojiUnescape } from "discourse/lib/text";-import { escapeExpression } from "discourse/lib/utilities";+import { escapeExpression, modKeysPressed } from "discourse/lib/utilities";import { getOwner } from "discourse-common/lib/get-owner";import getURL from "discourse-common/lib/get-url";import { isEmpty } from "@ember/utils";@@ -508,11 +508,35 @@ export default Controller.extend({this.set("model.showFullScreenExitPrompt", false);},- actions: {- togglePreview() {- this.toggleProperty("showPreview");- },+ @action+ async cancel(event) {+ event?.preventDefault();+ await this.cancelComposer();+ },++ @action+ cancelUpload(event) {+ event?.preventDefault();+ this.set("model.uploadCancelled", true);+ },++ @action+ togglePreview(event) {+ event?.preventDefault();+ this.toggleProperty("showPreview");+ },++ @action+ viewNewReply(event) {+ if (event && modKeysPressed(event).length > 0) {+ return false;+ }+ event?.preventDefault();+ DiscourseURL.routeTo(this.get("model.createdPost.url"));+ this.close();+ },+ actions: {closeComposer() {this.close();},@@ -543,10 +567,6 @@ export default Controller.extend({});},- cancelUpload() {- this.set("model.uploadCancelled", true);- },-onPopupMenuAction(menuAction) {this.send(menuAction);},@@ -707,10 +727,6 @@ export default Controller.extend({this.set("model.loading", false);},- async cancel() {- await this.cancelComposer();- },-save(ignore, event) {this.save(false, {jump:@@ -1275,12 +1291,6 @@ export default Controller.extend({}},- viewNewReply() {- DiscourseURL.routeTo(this.get("model.createdPost.url"));- this.close();- return false;- },-async destroyDraft(draftSequence = null) {const key = this.get("model.draftKey");if (!key) {diff --git a/app/assets/javascripts/discourse/app/controllers/discovery/categories.js b/app/assets/javascripts/discourse/app/controllers/discovery/categories.jsindex c46f41c1c82..1e07f67cb99 100644--- a/app/assets/javascripts/discourse/app/controllers/discovery/categories.js+++ b/app/assets/javascripts/discourse/app/controllers/discovery/categories.js@@ -1,5 +1,6 @@import DiscoveryController from "discourse/controllers/discovery";import { inject as controller } from "@ember/controller";+import { action } from "@ember/object";import { dasherize } from "@ember/string";import discourseComputed from "discourse-common/utils/decorators";import { reads } from "@ember/object/computed";@@ -50,17 +51,19 @@ export default DiscoveryController.extend({: style;return dasherize(componentName);},++ @action+ showInserted(event) {+ event?.preventDefault();+ const tracker = this.topicTrackingState;+ // Move inserted into topics+ this.model.loadBefore(tracker.get("newIncoming"), true);+ tracker.resetTracking();+ },+actions: {refresh() {this.send("triggerRefresh");},- showInserted() {- const tracker = this.topicTrackingState;-- // Move inserted into topics- this.model.loadBefore(tracker.get("newIncoming"), true);- tracker.resetTracking();- return false;- },},});diff --git a/app/assets/javascripts/discourse/app/controllers/discovery/topics.js b/app/assets/javascripts/discourse/app/controllers/discovery/topics.jsindex a0037f4da57..3e90fd42a86 100644--- a/app/assets/javascripts/discourse/app/controllers/discovery/topics.js+++ b/app/assets/javascripts/discourse/app/controllers/discovery/topics.js@@ -63,6 +63,17 @@ const controllerOpts = {return this._isFilterPage(filter, "new") && topicsLength > 0;},+ // Show newly inserted topics+ @action+ showInserted(event) {+ event?.preventDefault();+ const tracker = this.topicTrackingState;++ // Move inserted into topics+ this.model.loadBefore(tracker.get("newIncoming"), true);+ tracker.resetTracking();+ },+actions: {changeSort() {deprecated(@@ -72,16 +83,6 @@ const controllerOpts = {return routeAction("changeSort", this.router._router, ...arguments)();},- // Show newly inserted topics- showInserted() {- const tracker = this.topicTrackingState;-- // Move inserted into topics- this.model.loadBefore(tracker.get("newIncoming"), true);- tracker.resetTracking();- return false;- },-refresh(options = { skipResettingParams: [] }) {const filter = this.get("model.filter");this.send("resetParams", options.skipResettingParams);diff --git a/app/assets/javascripts/discourse/app/controllers/full-page-search.js b/app/assets/javascripts/discourse/app/controllers/full-page-search.jsindex e082ca9d29b..a7cf017c6aa 100644--- a/app/assets/javascripts/discourse/app/controllers/full-page-search.js+++ b/app/assets/javascripts/discourse/app/controllers/full-page-search.js@@ -14,6 +14,7 @@ import I18n from "I18n";import { ajax } from "discourse/lib/ajax";import { escapeExpression } from "discourse/lib/utilities";import { isEmpty } from "@ember/utils";+import { action } from "@ember/object";import { gt, or } from "@ember/object/computed";import { scrollTop } from "discourse/mixins/scroll-top";import { setTransient } from "discourse/lib/page-tracker";@@ -391,22 +392,24 @@ export default Controller.extend({}},- actions: {- createTopic(searchTerm) {- let topicCategory;- if (searchTerm.includes("category:")) {- const match = searchTerm.match(/category:(\S*)/);- if (match && match[1]) {- topicCategory = match[1];- }+ @action+ createTopic(searchTerm, event) {+ event?.preventDefault();+ let topicCategory;+ if (searchTerm.includes("category:")) {+ const match = searchTerm.match(/category:(\S*)/);+ if (match && match[1]) {+ topicCategory = match[1];}- this.composer.open({- action: Composer.CREATE_TOPIC,- draftKey: Composer.NEW_TOPIC_KEY,- topicCategory,- });- },+ }+ this.composer.open({+ action: Composer.CREATE_TOPIC,+ draftKey: Composer.NEW_TOPIC_KEY,+ topicCategory,+ });+ },+ actions: {selectAll() {this.selected.addObjects(this.get("model.posts").mapBy("topic"));diff --git a/app/assets/javascripts/discourse/app/controllers/history.js b/app/assets/javascripts/discourse/app/controllers/history.jsindex 2540c78b54b..00e64f86da3 100644--- a/app/assets/javascripts/discourse/app/controllers/history.js+++ b/app/assets/javascripts/discourse/app/controllers/history.js@@ -1,3 +1,4 @@+import { action } from "@ember/object";import { alias, equal, gt, not, or } from "@ember/object/computed";import discourseComputed, {observes,@@ -313,6 +314,24 @@ export default Controller.extend(ModalFunctionality, {}},+ @action+ displayInline(event) {+ event?.preventDefault();+ this.set("viewMode", "inline");+ },++ @action+ displaySideBySide(event) {+ event?.preventDefault();+ this.set("viewMode", "side_by_side");+ },++ @action+ displaySideBySideMarkdown(event) {+ event?.preventDefault();+ this.set("viewMode", "side_by_side_markdown");+ },+actions: {loadFirstVersion() {this.refresh(this.get("model.post_id"), this.get("model.first_revision"));@@ -345,15 +364,5 @@ export default Controller.extend(ModalFunctionality, {revertToVersion() {this.revert(this.post, this.get("model.current_revision"));},-- displayInline() {- this.set("viewMode", "inline");- },- displaySideBySide() {- this.set("viewMode", "side_by_side");- },- displaySideBySideMarkdown() {- this.set("viewMode", "side_by_side_markdown");- },},});diff --git a/app/assets/javascripts/discourse/app/controllers/login.js b/app/assets/javascripts/discourse/app/controllers/login.jsindex 1a5a4ecc7f8..401c85f354a 100644--- a/app/assets/javascripts/discourse/app/controllers/login.js+++ b/app/assets/javascripts/discourse/app/controllers/login.js@@ -3,7 +3,7 @@ import { alias, not, or, readOnly } from "@ember/object/computed";import { areCookiesEnabled, escapeExpression } from "discourse/lib/utilities";import cookie, { removeCookie } from "discourse/lib/cookie";import { next, schedule } from "@ember/runloop";-import EmberObject from "@ember/object";+import EmberObject, { action } from "@ember/object";import I18n from "I18n";import ModalFunctionality from "discourse/mixins/modal-functionality";import { SECOND_FACTOR_METHODS } from "discourse/models/user";@@ -133,7 +133,66 @@ export default Controller.extend(ModalFunctionality, {return canLoginLocalWithEmail;},+ @action+ emailLogin(event) {+ event?.preventDefault();++ if (this.processingEmailLink) {+ return;+ }++ if (isEmpty(this.loginName)) {+ this.flash(I18n.t("login.blank_username"), "info");+ return;+ }++ this.set("processingEmailLink", true);++ ajax("/u/email-login", {+ data: { login: this.loginName.trim() },+ type: "POST",+ })+ .then((data) => {+ const loginName = escapeExpression(this.loginName);+ const isEmail = loginName.match(/@/);+ let key = `email_login.complete_${isEmail ? "email" : "username"}`;+ if (data.user_found === false) {+ this.flash(+ I18n.t(`${key}_not_found`, {+ email: loginName,+ username: loginName,+ }),+ "error"+ );+ } else {+ let postfix = data.hide_taken ? "" : "_found";+ this.flash(+ I18n.t(`${key}${postfix}`, {+ email: loginName,+ username: loginName,+ })+ );+ }+ })+ .catch((e) => this.flash(extractError(e), "error"))+ .finally(() => this.set("processingEmailLink", false));+ },++ @action+ handleForgotPassword(event) {+ event?.preventDefault();+ const forgotPasswordController = this.forgotPassword;+ if (forgotPasswordController) {+ forgotPasswordController.set("accountEmailOrUsername", this.loginName);+ }+ this.send("showForgotPassword");+ },+actions: {+ forgotPassword() {+ this.handleForgotPassword();+ },+login() {if (this.loginDisabled) {return;@@ -297,56 +356,6 @@ export default Controller.extend(ModalFunctionality, {this.send("showCreateAccount");},- forgotPassword() {- const forgotPasswordController = this.forgotPassword;- if (forgotPasswordController) {- forgotPasswordController.set("accountEmailOrUsername", this.loginName);- }- this.send("showForgotPassword");- },-- emailLogin() {- if (this.processingEmailLink) {- return;- }-- if (isEmpty(this.loginName)) {- this.flash(I18n.t("login.blank_username"), "info");- return;- }-- this.set("processingEmailLink", true);-- ajax("/u/email-login", {- data: { login: this.loginName.trim() },- type: "POST",- })- .then((data) => {- const loginName = escapeExpression(this.loginName);- const isEmail = loginName.match(/@/);- let key = `email_login.complete_${isEmail ? "email" : "username"}`;- if (data.user_found === false) {- this.flash(- I18n.t(`${key}_not_found`, {- email: loginName,- username: loginName,- }),- "error"- );- } else {- let postfix = data.hide_taken ? "" : "_found";- this.flash(- I18n.t(`${key}${postfix}`, {- email: loginName,- username: loginName,- })- );- }- })- .catch((e) => this.flash(extractError(e), "error"))- .finally(() => this.set("processingEmailLink", false));- },-authenticateSecurityKey() {getWebauthnCredential(this.securityKeyChallenge,diff --git a/app/assets/javascripts/discourse/app/controllers/password-reset.js b/app/assets/javascripts/discourse/app/controllers/password-reset.jsindex bae85083a88..472a69005dd 100644--- a/app/assets/javascripts/discourse/app/controllers/password-reset.js+++ b/app/assets/javascripts/discourse/app/controllers/password-reset.js@@ -1,4 +1,5 @@import DiscourseURL, { userPath } from "discourse/lib/url";+import { action } from "@ember/object";import { alias, or, readOnly } from "@ember/object/computed";import Controller from "@ember/controller";import I18n from "I18n";@@ -8,6 +9,7 @@ import { ajax } from "discourse/lib/ajax";import discourseComputed from "discourse-common/utils/decorators";import getURL from "discourse-common/lib/get-url";import { getWebauthnCredential } from "discourse/lib/webauthn";+import { modKeysPressed } from "discourse/lib/utilities";export default Controller.extend(PasswordValidation, {isDeveloper: alias("model.is_developer"),@@ -46,6 +48,16 @@ export default Controller.extend(PasswordValidation, {lockImageUrl: getURL("/images/lock.svg"),+ @action+ done(event) {+ if (event && modKeysPressed(event).length > 0) {+ return false;+ }+ event?.preventDefault();+ this.set("redirected", true);+ DiscourseURL.redirectTo(this.redirectTo || "/");+ },+actions: {submit() {ajax({@@ -126,10 +138,5 @@ export default Controller.extend(PasswordValidation, {});},-- done() {- this.set("redirected", true);- DiscourseURL.redirectTo(this.redirectTo || "/");- },},});diff --git a/app/assets/javascripts/discourse/app/controllers/preferences/account.js b/app/assets/javascripts/discourse/app/controllers/preferences/account.jsindex 6c3051d4522..94ba197cfdb 100644--- a/app/assets/javascripts/discourse/app/controllers/preferences/account.js+++ b/app/assets/javascripts/discourse/app/controllers/preferences/account.js@@ -2,7 +2,7 @@ import { gt, not, or } from "@ember/object/computed";import { propertyNotEqual, setting } from "discourse/lib/computed";import CanCheckEmails from "discourse/mixins/can-check-emails";import Controller from "@ember/controller";-import EmberObject from "@ember/object";+import EmberObject, { action } from "@ember/object";import I18n from "I18n";import discourseComputed from "discourse-common/utils/decorators";import { findAll } from "discourse/models/login-method";@@ -132,6 +132,20 @@ export default Controller.extend(CanCheckEmails, {return findAll().length > 0;},+ @action+ resendConfirmationEmail(email, event) {+ event?.preventDefault();+ email.set("resending", true);+ this.model+ .addEmail(email.email)+ .then(() => {+ email.set("resent", true);+ })+ .finally(() => {+ email.set("resending", false);+ });+ },+actions: {save() {this.set("saved", false);@@ -157,18 +171,6 @@ export default Controller.extend(CanCheckEmails, {this.model.destroyEmail(email);},- resendConfirmationEmail(email) {- email.set("resending", true);- this.model- .addEmail(email.email)- .then(() => {- email.set("resent", true);- })- .finally(() => {- email.set("resending", false);- });- },-delete() {this.dialog.alert({message: I18n.t("user.delete_account_confirm"),diff --git a/app/assets/javascripts/discourse/app/controllers/preferences/second-factor.js b/app/assets/javascripts/discourse/app/controllers/preferences/second-factor.jsindex 946903a5684..fc5293054a6 100644--- a/app/assets/javascripts/discourse/app/controllers/preferences/second-factor.js+++ b/app/assets/javascripts/discourse/app/controllers/preferences/second-factor.js@@ -3,6 +3,7 @@ import CanCheckEmails from "discourse/mixins/can-check-emails";import Controller from "@ember/controller";import I18n from "I18n";import { SECOND_FACTOR_METHODS } from "discourse/models/user";+import { action } from "@ember/object";import { alias } from "@ember/object/computed";import bootbox from "bootbox";import discourseComputed from "discourse-common/utils/decorators";@@ -91,6 +92,27 @@ export default Controller.extend(CanCheckEmails, {this.set("dirty", true);},+ @action+ resetPassword(event) {+ event?.preventDefault();++ this.setProperties({+ resetPasswordLoading: true,+ resetPasswordProgress: "",+ });++ return this.model+ .changePassword()+ .then(() => {+ this.set(+ "resetPasswordProgress",+ I18n.t("user.change_password.success")+ );+ })+ .catch(popupAjaxError)+ .finally(() => this.set("resetPasswordLoading", false));+ },+actions: {confirmPassword() {if (!this.password) {@@ -101,24 +123,6 @@ export default Controller.extend(CanCheckEmails, {this.set("password", null);},- resetPassword() {- this.setProperties({- resetPasswordLoading: true,- resetPasswordProgress: "",- });-- return this.model- .changePassword()- .then(() => {- this.set(- "resetPasswordProgress",- I18n.t("user.change_password.success")- );- })- .catch(popupAjaxError)- .finally(() => this.set("resetPasswordLoading", false));- },-disableAllSecondFactors() {if (this.loading) {return;diff --git a/app/assets/javascripts/discourse/app/controllers/preferences/security.js b/app/assets/javascripts/discourse/app/controllers/preferences/security.jsindex c1e7dc52c0b..800d597c651 100644--- a/app/assets/javascripts/discourse/app/controllers/preferences/security.js+++ b/app/assets/javascripts/discourse/app/controllers/preferences/security.js@@ -1,4 +1,5 @@import Controller from "@ember/controller";+import { action } from "@ember/object";import { gt } from "@ember/object/computed";import discourseComputed from "discourse-common/utils/decorators";import { ajax } from "discourse/lib/ajax";@@ -51,6 +52,56 @@ export default Controller.extend(CanCheckEmails, {DEFAULT_AUTH_TOKENS_COUNT),+ @action+ changePassword(event) {+ event?.preventDefault();+ if (!this.passwordProgress) {+ this.set("passwordProgress", I18n.t("user.change_password.in_progress"));+ return this.model+ .changePassword()+ .then(() => {+ // password changed+ this.setProperties({+ changePasswordProgress: false,+ passwordProgress: I18n.t("user.change_password.success"),+ });+ })+ .catch(() => {+ // password failed to change+ this.setProperties({+ changePasswordProgress: false,+ passwordProgress: I18n.t("user.change_password.error"),+ });+ });+ }+ },++ @action+ toggleShowAllAuthTokens(event) {+ event?.preventDefault();+ this.toggleProperty("showAllAuthTokens");+ },++ @action+ revokeAuthToken(token, event) {+ event?.preventDefault();+ ajax(+ userPath(+ `${this.get("model.username_lower")}/preferences/revoke-auth-token`+ ),+ {+ type: "POST",+ data: token ? { token_id: token.id } : {},+ }+ )+ .then(() => {+ if (!token) {+ logout();+ } // All sessions revoked+ })+ .catch(popupAjaxError);+ },+actions: {save() {this.set("saved", false);@@ -60,53 +111,6 @@ export default Controller.extend(CanCheckEmails, {.catch(popupAjaxError);},- changePassword() {- if (!this.passwordProgress) {- this.set(- "passwordProgress",- I18n.t("user.change_password.in_progress")- );- return this.model- .changePassword()- .then(() => {- // password changed- this.setProperties({- changePasswordProgress: false,- passwordProgress: I18n.t("user.change_password.success"),- });- })- .catch(() => {- // password failed to change- this.setProperties({- changePasswordProgress: false,- passwordProgress: I18n.t("user.change_password.error"),- });- });- }- },-- toggleShowAllAuthTokens() {- this.toggleProperty("showAllAuthTokens");- },-- revokeAuthToken(token) {- ajax(- userPath(- `${this.get("model.username_lower")}/preferences/revoke-auth-token`- ),- {- type: "POST",- data: token ? { token_id: token.id } : {},- }- )- .then(() => {- if (!token) {- logout();- } // All sessions revoked- })- .catch(popupAjaxError);- },-showToken(token) {showModal("auth-token", { model: token });},diff --git a/app/assets/javascripts/discourse/app/controllers/second-factor-add-totp.js b/app/assets/javascripts/discourse/app/controllers/second-factor-add-totp.jsindex bdc1f3511d5..2ed9127535e 100644--- a/app/assets/javascripts/discourse/app/controllers/second-factor-add-totp.js+++ b/app/assets/javascripts/discourse/app/controllers/second-factor-add-totp.js@@ -1,4 +1,5 @@import Controller from "@ember/controller";+import { action } from "@ember/object";import I18n from "I18n";import ModalFunctionality from "discourse/mixins/modal-functionality";@@ -40,9 +41,15 @@ export default Controller.extend(ModalFunctionality, {.finally(() => this.set("loading", false));},+ @action+ enableShowSecondFactorKey(event) {+ event?.preventDefault();+ this.set("showSecondFactorKey", true);+ },+actions: {showSecondFactorKey() {- this.set("showSecondFactorKey", true);+ this.enableShowSecondFactorKey();},enableSecondFactor() {diff --git a/app/assets/javascripts/discourse/app/controllers/second-factor-auth.js b/app/assets/javascripts/discourse/app/controllers/second-factor-auth.jsindex 8e88afdf95d..f4199f9ee9b 100644--- a/app/assets/javascripts/discourse/app/controllers/second-factor-auth.js+++ b/app/assets/javascripts/discourse/app/controllers/second-factor-auth.js@@ -212,7 +212,8 @@ export default Controller.extend({},@action- useAnotherMethod(newMethod) {+ useAnotherMethod(newMethod, event) {+ event?.preventDefault();this.set("userSelectedMethod", newMethod);},diff --git a/app/assets/javascripts/discourse/app/controllers/tag-show.js b/app/assets/javascripts/discourse/app/controllers/tag-show.jsindex 619c5e860df..2f9c4935165 100644--- a/app/assets/javascripts/discourse/app/controllers/tag-show.js+++ b/app/assets/javascripts/discourse/app/controllers/tag-show.js@@ -110,7 +110,8 @@ export default DiscoverySortableController.extend(},@action- showInserted() {+ showInserted(event) {+ event?.preventDefault();const tracker = this.topicTrackingState;this.list.loadBefore(tracker.newIncoming, true);tracker.resetTracking();diff --git a/app/assets/javascripts/discourse/app/controllers/tags-index.js b/app/assets/javascripts/discourse/app/controllers/tags-index.jsindex ec56d24003a..eff2f1d30bc 100644--- a/app/assets/javascripts/discourse/app/controllers/tags-index.js+++ b/app/assets/javascripts/discourse/app/controllers/tags-index.js@@ -1,3 +1,4 @@+import { action } from "@ember/object";import { alias, notEmpty } from "@ember/object/computed";import Controller from "@ember/controller";import I18n from "I18n";@@ -41,23 +42,27 @@ export default Controller.extend({};},- actions: {- sortByCount() {- this.setProperties({- sortProperties: ["totalCount:desc", "id"],- sortedByCount: true,- sortedByName: false,- });- },+ @action+ sortByCount(event) {+ event?.preventDefault();+ this.setProperties({+ sortProperties: ["totalCount:desc", "id"],+ sortedByCount: true,+ sortedByName: false,+ });+ },- sortById() {- this.setProperties({- sortProperties: ["id"],- sortedByCount: false,- sortedByName: true,- });- },+ @action+ sortById(event) {+ event?.preventDefault();+ this.setProperties({+ sortProperties: ["id"],+ sortedByCount: false,+ sortedByName: true,+ });+ },+ actions: {showUploader() {showModal("tag-upload");},diff --git a/app/assets/javascripts/discourse/app/controllers/topic.js b/app/assets/javascripts/discourse/app/controllers/topic.jsindex aace5530cbe..7b1da2f6540 100644--- a/app/assets/javascripts/discourse/app/controllers/topic.js+++ b/app/assets/javascripts/discourse/app/controllers/topic.js@@ -19,7 +19,7 @@ import { ajax } from "discourse/lib/ajax";import { bufferedProperty } from "discourse/mixins/buffered-content";import { buildQuote } from "discourse/lib/quote";import { deepMerge } from "discourse-common/lib/object";-import { escapeExpression } from "discourse/lib/utilities";+import { escapeExpression, modKeysPressed } from "discourse/lib/utilities";import { extractLinkMeta } from "discourse/lib/render-topic-featured-link";import { popupAjaxError } from "discourse/lib/ajax-error";import { inject as service } from "@ember/service";@@ -313,6 +313,58 @@ export default Controller.extend(bufferedProperty("model"), {});},+ @action+ editTopic(event) {+ event?.preventDefault();+ if (this.get("model.details.can_edit")) {+ this.set("editingTopic", true);+ }+ },++ @action+ jumpTop(event) {+ if (event && modKeysPressed(event).length > 0) {+ return false;+ }+ event?.preventDefault();+ DiscourseURL.routeTo(this.get("model.firstPostUrl"), {+ skipIfOnScreen: false,+ keepFilter: true,+ });+ },++ @action+ removeFeaturedLink(event) {+ event?.preventDefault();+ this.set("buffered.featured_link", null);+ },++ @action+ selectAll(event) {+ event?.preventDefault();+ const smallActionsPostIds = this._smallActionPostIds();+ this.set("selectedPostIds", [+ ...this.get("model.postStream.stream").filter(+ (postId) => !smallActionsPostIds.has(postId)+ ),+ ]);+ this._forceRefreshPostStream();+ },++ @action+ deselectAll(event) {+ event?.preventDefault();+ this.set("selectedPostIds", []);+ this._forceRefreshPostStream();+ },++ @action+ toggleMultiSelect(event) {+ event?.preventDefault();+ this.toggleProperty("multiSelect");+ this._forceRefreshPostStream();+ },+actions: {topicCategoryChanged(categoryId) {this.set("buffered.category_id", categoryId);@@ -822,13 +874,6 @@ export default Controller.extend(bufferedProperty("model"), {this._jumpToPostNumber(postNumber);},- jumpTop() {- DiscourseURL.routeTo(this.get("model.firstPostUrl"), {- skipIfOnScreen: false,- keepFilter: true,- });- },-jumpBottom() {// When a topic only has one lengthy postconst jumpEnd = this.model.highest_post_number === 1 ? true : false;@@ -859,26 +904,6 @@ export default Controller.extend(bufferedProperty("model"), {this._jumpToPostId(postId);},- toggleMultiSelect() {- this.toggleProperty("multiSelect");- this._forceRefreshPostStream();- },-- selectAll() {- const smallActionsPostIds = this._smallActionPostIds();- this.set("selectedPostIds", [- ...this.get("model.postStream.stream").filter(- (postId) => !smallActionsPostIds.has(postId)- ),- ]);- this._forceRefreshPostStream();- },-- deselectAll() {- this.set("selectedPostIds", []);- this._forceRefreshPostStream();- },-togglePostSelection(post) {const selected = this.selectedPostIds;selected.includes(post.id)@@ -973,13 +998,6 @@ export default Controller.extend(bufferedProperty("model"), {.then(() => this.updateQueryParams);},- editTopic() {- if (this.get("model.details.can_edit")) {- this.set("editingTopic", true);- }- return false;- },-cancelEditingTopic() {this.set("editingTopic", false);this.rollbackBuffer();@@ -1159,10 +1177,6 @@ export default Controller.extend(bufferedProperty("model"), {.catch(popupAjaxError);},- removeFeaturedLink() {- this.set("buffered.featured_link", null);- },-resetBumpDate() {this.model.resetBumpDate();},diff --git a/app/assets/javascripts/discourse/app/controllers/user-private-messages-tags.js b/app/assets/javascripts/discourse/app/controllers/user-private-messages-tags.jsindex 9d4f5368660..b73149358f3 100644--- a/app/assets/javascripts/discourse/app/controllers/user-private-messages-tags.js+++ b/app/assets/javascripts/discourse/app/controllers/user-private-messages-tags.js@@ -1,25 +1,29 @@import Controller from "@ember/controller";+import { action } from "@ember/object";+export default Controller.extend({sortProperties: ["count:desc", "id"],tagsForUser: null,sortedByCount: true,sortedByName: false,- actions: {- sortByCount() {- this.setProperties({- sortProperties: ["count:desc", "id"],- sortedByCount: true,- sortedByName: false,- });- },+ @action+ sortByCount(event) {+ event?.preventDefault();+ this.setProperties({+ sortProperties: ["count:desc", "id"],+ sortedByCount: true,+ sortedByName: false,+ });+ },- sortById() {- this.setProperties({- sortProperties: ["id"],- sortedByCount: false,- sortedByName: true,- });- },+ @action+ sortById(event) {+ event?.preventDefault();+ this.setProperties({+ sortProperties: ["id"],+ sortedByCount: false,+ sortedByName: true,+ });},});diff --git a/app/assets/javascripts/discourse/app/controllers/user-topics-list.js b/app/assets/javascripts/discourse/app/controllers/user-topics-list.jsindex 021502f615e..a40ab97f4e9 100644--- a/app/assets/javascripts/discourse/app/controllers/user-topics-list.js+++ b/app/assets/javascripts/discourse/app/controllers/user-topics-list.js@@ -81,10 +81,10 @@ export default Controller.extend(BulkTopicSelection, {},@action- showInserted() {+ showInserted(event) {+ event?.preventDefault();this.model.loadBefore(this.pmTopicTrackingState.newIncoming);this.pmTopicTrackingState.resetIncomingTracking();- return false;},@actiondiff --git a/app/assets/javascripts/discourse/app/controllers/user.js b/app/assets/javascripts/discourse/app/controllers/user.jsindex 4c8ba40cbca..8f2d24beb1b 100644--- a/app/assets/javascripts/discourse/app/controllers/user.js+++ b/app/assets/javascripts/discourse/app/controllers/user.js@@ -211,6 +211,15 @@ export default Controller.extend(CanCheckEmails, {}},+ @action+ showSuspensions(event) {+ event?.preventDefault();+ this.adminTools.showActionLogs(this, {+ target_user: this.get("model.username"),+ action_name: "suspend_user",+ });+ },+actions: {collapseProfile() {this.set("forceExpand", false);@@ -220,13 +229,6 @@ export default Controller.extend(CanCheckEmails, {this.set("forceExpand", true);},- showSuspensions() {- this.adminTools.showActionLogs(this, {- target_user: this.get("model.username"),- action_name: "suspend_user",- });- },-adminDelete() {const userId = this.get("model.id");const location = document.location.pathname;diff --git a/app/assets/javascripts/discourse/app/lib/utilities.js b/app/assets/javascripts/discourse/app/lib/utilities.jsindex d2ae39cdea6..9f5b02fac4d 100644--- a/app/assets/javascripts/discourse/app/lib/utilities.js+++ b/app/assets/javascripts/discourse/app/lib/utilities.js@@ -489,6 +489,12 @@ export function inCodeBlock(text, pos) {return lastOpenBlock !== -1 && pos >= end + lastOpenBlock;}+// Return an array of modifier keys that are pressed during a given `MouseEvent`+// or `KeyboardEvent`.+export function modKeysPressed(event) {+ return ["alt", "shift", "meta", "ctrl"].filter((key) => event[`${key}Key`]);+}+export function translateModKey(string) {const { isApple } = helperContext().capabilities;// Apple device users are used to glyphs for shortcut keysdiff --git a/app/assets/javascripts/discourse/app/templates/components/categories-only.hbs b/app/assets/javascripts/discourse/app/templates/components/categories-only.hbsindex 338e4b1cf50..6f3be0d4a92 100644--- a/app/assets/javascripts/discourse/app/templates/components/categories-only.hbs+++ b/app/assets/javascripts/discourse/app/templates/components/categories-only.hbs@@ -20,7 +20,7 @@{{#if this.mutedCategories}}<div class="muted-categories">- <a href class="muted-categories-link" {{action "toggleShowMuted"}}>+ <a href class="muted-categories-link" {{on "click" this.toggleShowMuted}}><h3 class="muted-categories-heading">{{i18n "categories.muted"}}</h3>{{#if this.mutedToggleIcon}}{{d-icon this.mutedToggleIcon}}diff --git a/app/assets/javascripts/discourse/app/templates/components/category-permission-row.hbs b/app/assets/javascripts/discourse/app/templates/components/category-permission-row.hbsindex 16e062fda2d..4acbfc6298f 100644--- a/app/assets/javascripts/discourse/app/templates/components/category-permission-row.hbs+++ b/app/assets/javascripts/discourse/app/templates/components/category-permission-row.hbs@@ -1,6 +1,6 @@<span class="group-name"><span class="group-name-label">{{this.group_name}}</span>- <a class="remove-permission" href {{action "removeRow"}}>+ <a class="remove-permission" href {{on "click" this.removeRow}}>{{d-icon "far-trash-alt"}}</a></span>diff --git a/app/assets/javascripts/discourse/app/templates/components/choose-message.hbs b/app/assets/javascripts/discourse/app/templates/components/choose-message.hbsindex ce6c36f17d3..c7d07e87f2e 100644--- a/app/assets/javascripts/discourse/app/templates/components/choose-message.hbs+++ b/app/assets/javascripts/discourse/app/templates/components/choose-message.hbs@@ -11,7 +11,7 @@{{#each this.messages as |m|}}<div class="controls existing-message"><label class="radio">- <input id="choose-message-{{m.id}}" {{action "chooseMessage" m}} type="radio" name="choose_message_id">+ <input id="choose-message-{{m.id}}" {{on "click" (fn this.chooseMessage m)}} type="radio" name="choose_message_id"><span class="message-title">{{m.title}}</span>diff --git a/app/assets/javascripts/discourse/app/templates/components/edit-category-tab.hbs b/app/assets/javascripts/discourse/app/templates/components/edit-category-tab.hbsindex 836736abf7b..f59b10dd5b9 100644--- a/app/assets/javascripts/discourse/app/templates/components/edit-category-tab.hbs+++ b/app/assets/javascripts/discourse/app/templates/components/edit-category-tab.hbs@@ -1 +1 @@-<a href {{action "select"}} class={{if this.active "active"}}>{{this.title}}</a>+<a href {{on "click" this.select}} class={{if this.active "active"}}>{{this.title}}</a>diff --git a/app/assets/javascripts/discourse/app/templates/components/emoji-group-buttons.hbs b/app/assets/javascripts/discourse/app/templates/components/emoji-group-buttons.hbsindex f7e48e39518..d0eac567ac0 100644--- a/app/assets/javascripts/discourse/app/templates/components/emoji-group-buttons.hbs+++ b/app/assets/javascripts/discourse/app/templates/components/emoji-group-buttons.hbs@@ -1,30 +1,30 @@{{!-- DO NOT EDIT THIS FILE!!! --}}{{!-- Update it by running `rake javascript:update_constants` --}}-<button type="button" data-section="smileys_&_emotion" {{action this.onCategorySelection "smileys_&_emotion"}} class="btn btn-default category-button emoji">+<button type="button" data-section="smileys_&_emotion" {{on "click" (fn this.onCategorySelection "smileys_&_emotion")}} class="btn btn-default category-button emoji">{{replace-emoji ":grinning:"}}</button>-<button type="button" data-section="people_&_body" {{action this.onCategorySelection "people_&_body"}} class="btn btn-default category-button emoji">+<button type="button" data-section="people_&_body" {{on "click" (fn this.onCategorySelection "people_&_body")}} class="btn btn-default category-button emoji">{{replace-emoji ":wave:"}}</button>-<button type="button" data-section="animals_&_nature" {{action this.onCategorySelection "animals_&_nature"}} class="btn btn-default category-button emoji">+<button type="button" data-section="animals_&_nature" {{on "click" (fn this.onCategorySelection "animals_&_nature")}} class="btn btn-default category-button emoji">{{replace-emoji ":evergreen_tree:"}}</button>-<button type="button" data-section="food_&_drink" {{action this.onCategorySelection "food_&_drink"}} class="btn btn-default category-button emoji">+<button type="button" data-section="food_&_drink" {{on "click" (fn this.onCategorySelection "food_&_drink")}} class="btn btn-default category-button emoji">{{replace-emoji ":hamburger:"}}</button>-<button type="button" data-section="travel_&_places" {{action this.onCategorySelection "travel_&_places"}} class="btn btn-default category-button emoji">+<button type="button" data-section="travel_&_places" {{on "click" (fn this.onCategorySelection "travel_&_places")}} class="btn btn-default category-button emoji">{{replace-emoji ":airplane:"}}</button>-<button type="button" data-section="activities" {{action this.onCategorySelection "activities"}} class="btn btn-default category-button emoji">+<button type="button" data-section="activities" {{on "click" (fn this.onCategorySelection "activities")}} class="btn btn-default category-button emoji">{{replace-emoji ":soccer:"}}</button>-<button type="button" data-section="objects" {{action this.onCategorySelection "objects"}} class="btn btn-default category-button emoji">+<button type="button" data-section="objects" {{on "click" (fn this.onCategorySelection "objects")}} class="btn btn-default category-button emoji">{{replace-emoji ":eyeglasses:"}}</button>-<button type="button" data-section="symbols" {{action this.onCategorySelection "symbols"}} class="btn btn-default category-button emoji">+<button type="button" data-section="symbols" {{on "click" (fn this.onCategorySelection "symbols")}} class="btn btn-default category-button emoji">{{replace-emoji ":white_check_mark:"}}</button>-<button type="button" data-section="flags" {{action this.onCategorySelection "flags"}} class="btn btn-default category-button emoji">+<button type="button" data-section="flags" {{on "click" (fn this.onCategorySelection "flags")}} class="btn btn-default category-button emoji">{{replace-emoji ":checkered_flag:"}}</button>diff --git a/app/assets/javascripts/discourse/app/templates/components/emoji-picker.hbs b/app/assets/javascripts/discourse/app/templates/components/emoji-picker.hbsindex d35c0e5e2f9..cba02e4d653 100644--- a/app/assets/javascripts/discourse/app/templates/components/emoji-picker.hbs+++ b/app/assets/javascripts/discourse/app/templates/components/emoji-picker.hbs@@ -4,15 +4,15 @@{{!-- template-lint-enable no-invalid-interactive no-down-event-binding --}}<div class="emoji-picker-category-buttons">{{#if this.recentEmojis.length}}- <button type="button" data-section="recent" {{action "onCategorySelection" "recent"}} class="btn btn-default category-button emoji">+ <button type="button" data-section="recent" {{on "click" (fn this.onCategorySelection "recent")}} class="btn btn-default category-button emoji">{{replace-emoji ":star:"}}</button>{{/if}}- <EmojiGroupButtons @onCategorySelection={{action "onCategorySelection"}} @tagName="" />+ <EmojiGroupButtons @onCategorySelection={{this.onCategorySelection}} @tagName="" />{{#each-in this.customEmojis as |group emojis|}}- <button type="button" data-section={{concat "custom-" group}} {{action "onCategorySelection" (concat "custom-" group)}} class="btn btn-default category-button emoji">+ <button type="button" data-section={{concat "custom-" group}} {{on "click" (fn this.onCategorySelection (concat "custom-" group))}} class="btn btn-default category-button emoji">{{replace-emoji (concat ":" emojis.firstObject.code ":")}}</button>{{/each-in}}diff --git a/app/assets/javascripts/discourse/app/templates/components/flag-action-type.hbs b/app/assets/javascripts/discourse/app/templates/components/flag-action-type.hbsindex ba18d20f355..6e41deadef9 100644--- a/app/assets/javascripts/discourse/app/templates/components/flag-action-type.hbs+++ b/app/assets/javascripts/discourse/app/templates/components/flag-action-type.hbs@@ -2,7 +2,7 @@<h3>{{this.formattedName}}</h3><div class="controls"><label class="radio">- <input id="radio_{{this.flag.name_key}}" {{action "changePostActionType" this.flag}} type="radio" name="post_action_type_index">+ <input id="radio_{{this.flag.name_key}}" {{on "click" (action "changePostActionType" this.flag)}} type="radio" name="post_action_type_index"><div class="flag-action-type-details"><span class="description">{{html-safe this.flag.description}}</span>@@ -19,7 +19,7 @@{{else}}<div class="controls {{this.flag.name_key}}"><label class="radio">- <input id="radio_{{this.flag.name_key}}" {{action "changePostActionType" this.flag}} type="radio" name="post_action_type_index">+ <input id="radio_{{this.flag.name_key}}" {{on "click" (action "changePostActionType" this.flag)}} type="radio" name="post_action_type_index"><div class="flag-action-type-details"><strong>{{this.formattedName}}</strong>{{#if this.showDescription}}diff --git a/app/assets/javascripts/discourse/app/templates/components/group-card-contents.hbs b/app/assets/javascripts/discourse/app/templates/components/group-card-contents.hbsindex a47f02deca4..f93472eaeb8 100644--- a/app/assets/javascripts/discourse/app/templates/components/group-card-contents.hbs+++ b/app/assets/javascripts/discourse/app/templates/components/group-card-contents.hbs@@ -13,14 +13,14 @@{{else}}<div class="card-row first-row"><div class="group-card-avatar">- <a href={{this.groupPath}} {{action "showGroup" this.group}} class="card-huge-avatar">+ <a href={{this.groupPath}} {{on "click" (fn this.handleShowGroup this.group)}} class="card-huge-avatar"><AvatarFlair @flairName={{this.group.name}} @flairUrl={{this.group.flair_url}} @flairBgColor={{this.group.flair_bg_color}} @flairColor={{this.group.flair_color}} /></a></div><div class="names"><span><h1 class={{this.group.name}}>- <a href={{this.groupPath}} {{action "showGroup" this.group}} class="group-page-link">{{this.group.name}}</a>+ <a href={{this.groupPath}} {{on "click" (fn this.handleShowGroup this.group)}} class="group-page-link">{{this.group.name}}</a></h1>{{#if this.group.full_name}}<h2 class="full-name">{{this.group.full_name}}</h2>@@ -53,10 +53,10 @@<div class="card-row third-row"><div class="members metadata">{{#each this.group.members as |user|}}- <a {{action "close"}} href={{user.path}} class="card-tiny-avatar">{{bound-avatar user "tiny"}}</a>+ <a {{on "click" this.close}} href={{user.path}} class="card-tiny-avatar">{{bound-avatar user "tiny"}}</a>{{/each}}{{#if this.showMoreMembers}}- <a href={{this.groupPath}} {{action "showGroup" this.group}} class="more-members-link">+ <a href={{this.groupPath}} {{on "click" (fn this.handleShowGroup this.group)}} class="more-members-link"><span class="more-members-count">+{{this.moreMembersCount}} {{i18n "more"}}</span></a>{{/if}}diff --git a/app/assets/javascripts/discourse/app/templates/components/group-imap-email-settings.hbs b/app/assets/javascripts/discourse/app/templates/components/group-imap-email-settings.hbsindex 0033afdf8ae..e86851cb2c9 100644--- a/app/assets/javascripts/discourse/app/templates/components/group-imap-email-settings.hbs+++ b/app/assets/javascripts/discourse/app/templates/components/group-imap-email-settings.hbs@@ -34,7 +34,7 @@<div class="control-group"><div class="group-imap-prefill-options">- {{i18n "groups.manage.email.prefill.title"}} <a id="prefill_imap_gmail" href {{action "prefillSettings" "gmail"}}>{{i18n "groups.manage.email.prefill.gmail"}}</a>+ {{i18n "groups.manage.email.prefill.title"}} <a id="prefill_imap_gmail" href {{on "click" (fn this.prefillSettings "gmail")}}>{{i18n "groups.manage.email.prefill.gmail"}}</a></div></div>diff --git a/app/assets/javascripts/discourse/app/templates/components/group-manage-email-settings.hbs b/app/assets/javascripts/discourse/app/templates/components/group-manage-email-settings.hbsindex 709ab0615e5..7c59effdfd8 100644--- a/app/assets/javascripts/discourse/app/templates/components/group-manage-email-settings.hbs+++ b/app/assets/javascripts/discourse/app/templates/components/group-manage-email-settings.hbs@@ -3,7 +3,7 @@<p>{{i18n "groups.manage.email.smtp_instructions"}}</p><label for="enable_smtp">- <Input @type="checkbox" @checked={{this.group.smtp_enabled}} id="enable_smtp" tabindex="1" {{on "change" (action "smtpEnabledChange")}} />+ <Input @type="checkbox" @checked={{this.group.smtp_enabled}} id="enable_smtp" tabindex="1" {{on "change" this.smtpEnabledChange}} />{{i18n "groups.manage.email.enable_smtp"}}</label>@@ -23,7 +23,7 @@<div class="alert alert-warning">{{i18n "groups.manage.email.imap_alpha_warning"}}</div><label for="enable_imap">- <Input @type="checkbox" disabled={{not this.enableImapSettings}} @checked={{this.group.imap_enabled}} id="enable_imap" tabindex="8" {{on "change" (action "imapEnabledChange")}} />+ <Input @type="checkbox" disabled={{not this.enableImapSettings}} @checked={{this.group.imap_enabled}} id="enable_imap" tabindex="8" {{on "change" this.imapEnabledChange}} />{{i18n "groups.manage.email.enable_imap"}}</label>diff --git a/app/assets/javascripts/discourse/app/templates/components/group-member.hbs b/app/assets/javascripts/discourse/app/templates/components/group-member.hbsindex 78f084e8ff3..703a39658a8 100644--- a/app/assets/javascripts/discourse/app/templates/components/group-member.hbs+++ b/app/assets/javascripts/discourse/app/templates/components/group-member.hbs@@ -3,7 +3,7 @@</a><span>{{this.member.username}}</span>{{#unless this.automatic}}- <a href {{action "remove"}} class="remove">+ <a href {{on "click" this.remove}} class="remove">{{d-icon "times"}}</a>{{/unless}}diff --git a/app/assets/javascripts/discourse/app/templates/components/group-smtp-email-settings.hbs b/app/assets/javascripts/discourse/app/templates/components/group-smtp-email-settings.hbsindex 4263b725148..68623cda2bd 100644--- a/app/assets/javascripts/discourse/app/templates/components/group-smtp-email-settings.hbs+++ b/app/assets/javascripts/discourse/app/templates/components/group-smtp-email-settings.hbs@@ -40,7 +40,7 @@<div class="control-group"><div class="group-smtp-prefill-options">- {{i18n "groups.manage.email.prefill.title"}} <a id="prefill_smtp_gmail" href {{action "prefillSettings" "gmail"}}>{{i18n "groups.manage.email.prefill.gmail"}}</a>+ {{i18n "groups.manage.email.prefill.title"}} <a id="prefill_smtp_gmail" href {{on "click" (fn this.prefillSettings "gmail")}}>{{i18n "groups.manage.email.prefill.gmail"}}</a></div></div>diff --git a/app/assets/javascripts/discourse/app/templates/components/login-buttons.hbs b/app/assets/javascripts/discourse/app/templates/components/login-buttons.hbsindex ab36ebbfa03..b7a0ffeba7b 100644--- a/app/assets/javascripts/discourse/app/templates/components/login-buttons.hbs+++ b/app/assets/javascripts/discourse/app/templates/components/login-buttons.hbs@@ -1,5 +1,5 @@{{#each this.buttons as |b|}}- <button type="button" class="btn btn-social {{b.name}}" {{action this.externalLogin b}} aria-label={{b.screenReaderTitle}} tabindex="3">+ <button type="button" class="btn btn-social {{b.name}}" {{on "click" (action this.externalLogin b)}} aria-label={{b.screenReaderTitle}} tabindex="3">{{#if b.isGoogle}}<svg class="fa d-icon d-icon-custom-google-oauth2 svg-icon" viewBox="0 0 48 48"><defs><path id="a" d="M44.5 20H24v8.5h11.8C34.7 33.9 30.1 37 24 37c-7.2 0-13-5.8-13-13s5.8-13 13-13c3.1 0 5.9 1.1 8.1 2.9l6.4-6.4C34.6 4.1 29.6 2 24 2 11.8 2 2 11.8 2 24s9.8 22 22 22c11 0 21-8 21-22 0-1.3-.2-2.7-.5-4z"/></defs><clipPath id="b"><use href="#a" overflow="visible"/></clipPath><path clip-path="url(#b)" fill="#FBBC05" d="M0 37V11l17 13z"/><path clip-path="url(#b)" fill="#EA4335" d="M0 11l17 13 7-6.1L48 14V0H0z"/><path clip-path="url(#b)" fill="#34A853" d="M0 37l30-23 7.9 1L48 0v48H0z"/><path clip-path="url(#b)" fill="#4285F4" d="M48 48L17 24l-4-3 35-10z"/></svg>{{else if b.icon}}diff --git a/app/assets/javascripts/discourse/app/templates/components/reviewable-item.hbs b/app/assets/javascripts/discourse/app/templates/components/reviewable-item.hbsindex f98826d61bc..d5bfb00f08c 100644--- a/app/assets/javascripts/discourse/app/templates/components/reviewable-item.hbs+++ b/app/assets/javascripts/discourse/app/templates/components/reviewable-item.hbs@@ -10,7 +10,7 @@<span class="status">{{reviewable-status this.reviewable.status}}</span>- <a href {{action "explainReviewable" this.reviewable}} title={{i18n "review.explain.why"}} class="explain">+ <a href {{on "click" (fn this.explainReviewable this.reviewable)}} title={{i18n "review.explain.why"}} class="explain">{{d-icon "question-circle"}}</a></div>diff --git a/app/assets/javascripts/discourse/app/templates/components/reviewable-post-edits.hbs b/app/assets/javascripts/discourse/app/templates/components/reviewable-post-edits.hbsindex 16df22dbb5d..349953e9886 100644--- a/app/assets/javascripts/discourse/app/templates/components/reviewable-post-edits.hbs+++ b/app/assets/javascripts/discourse/app/templates/components/reviewable-post-edits.hbs@@ -1,5 +1,5 @@{{#if this.hasEdits}}- <a href {{action "showEditHistory"}} class="has-edits {{this.historyClass}}" title={{i18n "post.last_edited_on" dateTime=this.editedDate}}>+ <a href {{on "click" this.showEditHistory}} class="has-edits {{this.historyClass}}" title={{i18n "post.last_edited_on" dateTime=this.editedDate}}>{{d-icon "pencil-alt"}}</a>{{/if}}diff --git a/app/assets/javascripts/discourse/app/templates/components/reviewable-queued-post.hbs b/app/assets/javascripts/discourse/app/templates/components/reviewable-queued-post.hbsindex 5c18aab0cde..39b8e7dd3a0 100644--- a/app/assets/javascripts/discourse/app/templates/components/reviewable-queued-post.hbs+++ b/app/assets/javascripts/discourse/app/templates/components/reviewable-queued-post.hbs@@ -6,7 +6,7 @@{{category-badge this.reviewable.category}}<ReviewableTags @tags={{this.reviewable.payload.tags}} @tagName="" />{{#if this.reviewable.payload.via_email}}- <a href {{action "showRawEmail"}} class="show-raw-email">+ <a href {{on "click" this.showRawEmail}} class="show-raw-email">{{d-icon "far-envelope" title="post.via_email"}}</a>{{/if}}diff --git a/app/assets/javascripts/discourse/app/templates/components/search-result-entry.hbs b/app/assets/javascripts/discourse/app/templates/components/search-result-entry.hbsindex 25a563daa03..6e49ebe210f 100644--- a/app/assets/javascripts/discourse/app/templates/components/search-result-entry.hbs+++ b/app/assets/javascripts/discourse/app/templates/components/search-result-entry.hbs@@ -10,7 +10,7 @@<TrackSelected @selectedList={{this.selected}} @selectedId={{this.post.topic}} @class="bulk-select" />{{/if}}- <a href={{this.post.url}} {{action "logClick" this.post.topic_id}} class="search-link{{if this.post.topic.visited " visited"}}" role="heading" aria-level="2">+ <a href={{this.post.url}} {{on "click" (fn this.logClick this.post.topic_id)}} class="search-link{{if this.post.topic.visited " visited"}}" role="heading" aria-level="2">{{raw "topic-status" topic=this.post.topic showPrivateMessageIcon=true}}<span class="topic-title">{{#if this.post.useTopicTitleHeadline}}diff --git a/app/assets/javascripts/discourse/app/templates/components/second-factor-form.hbs b/app/assets/javascripts/discourse/app/templates/components/second-factor-form.hbsindex b5f1fbfbe25..714d1b4e92b 100644--- a/app/assets/javascripts/discourse/app/templates/components/second-factor-form.hbs+++ b/app/assets/javascripts/discourse/app/templates/components/second-factor-form.hbs@@ -7,7 +7,7 @@{{yield}}{{#if this.showToggleMethodLink}}<p>- <a href="" class="toggle-second-factor-method" {{action "toggleSecondFactorMethod"}}>{{ i18n this.linkText }}</a>+ <a href class="toggle-second-factor-method" {{on "click" this.toggleSecondFactorMethod}}>{{ i18n this.linkText }}</a></p>{{/if}}</div>diff --git a/app/assets/javascripts/discourse/app/templates/components/security-key-form.hbs b/app/assets/javascripts/discourse/app/templates/components/security-key-form.hbsindex f0f70b3c6c0..f321e2ca05f 100644--- a/app/assets/javascripts/discourse/app/templates/components/security-key-form.hbs+++ b/app/assets/javascripts/discourse/app/templates/components/security-key-form.hbs@@ -2,7 +2,7 @@<DButton @action={{this.action}} @icon="key" @id="security-key-authenticate-button" @label="login.security_key_authenticate" @type="button" @class="btn btn-large btn-primary" /><p>{{#if this.otherMethodAllowed}}- <a href="" class="toggle-second-factor-method" {{action "useAnotherMethod"}}>{{ i18n "login.security_key_alternative" }}</a>+ <a href class="toggle-second-factor-method" {{on "click" this.useAnotherMethod}}>{{ i18n "login.security_key_alternative" }}</a>{{/if}}</p></div>diff --git a/app/assets/javascripts/discourse/app/templates/components/selected-posts.hbs b/app/assets/javascripts/discourse/app/templates/components/selected-posts.hbsindex 09afc7c50ae..206ff4ae213 100644--- a/app/assets/javascripts/discourse/app/templates/components/selected-posts.hbs+++ b/app/assets/javascripts/discourse/app/templates/components/selected-posts.hbs@@ -4,7 +4,7 @@{{#if this.canSelectAll}}<p>- <a class="select-all" href {{action this.selectAll}}>+ <a class="select-all" href {{on "click" this.selectAll}}>{{i18n "topic.multi_select.select_all"}}</a></p>@@ -12,7 +12,7 @@{{#if this.canDeselectAll}}<p>- <a href {{action this.deselectAll}}>+ <a href {{on "click" this.deselectAll}}>{{i18n "topic.multi_select.deselect_all"}}</a></p>@@ -35,7 +35,7 @@{{/if}}<p class="cancel">- <a href {{action this.toggleMultiSelect}}>+ <a href {{on "click" this.toggleMultiSelect}}>{{i18n "topic.multi_select.cancel"}}</a></p>diff --git a/app/assets/javascripts/discourse/app/templates/components/signup-cta.hbs b/app/assets/javascripts/discourse/app/templates/components/signup-cta.hbsindex cf640feb23f..f6d4148d836 100644--- a/app/assets/javascripts/discourse/app/templates/components/signup-cta.hbs+++ b/app/assets/javascripts/discourse/app/templates/components/signup-cta.hbs@@ -10,7 +10,7 @@<div class="buttons"><DButton @action={{route-action "showCreateAccount"}} @label="signup_cta.sign_up" @icon="user" @class="btn-primary" /><DButton @action={{action "hideForSession"}} @label="signup_cta.hide_session" @class="no-icon" />- <a href {{action "neverShow"}}>{{i18n "signup_cta.hide_forever"}}</a>+ <a href {{on "click" this.neverShow}}>{{i18n "signup_cta.hide_forever"}}</a></div>{{/if}}</div>diff --git a/app/assets/javascripts/discourse/app/templates/components/tag-info.hbs b/app/assets/javascripts/discourse/app/templates/components/tag-info.hbsindex 4e1c2737671..b85e1bfa28b 100644--- a/app/assets/javascripts/discourse/app/templates/components/tag-info.hbs+++ b/app/assets/javascripts/discourse/app/templates/components/tag-info.hbs@@ -17,7 +17,7 @@<div class="tag-name-wrapper">{{discourse-tag this.tagInfo.name tagName="div"}}{{#if this.canAdminTag}}- <a href {{action "edit"}} class="edit-tag" title={{i18n "tagging.edit_tag"}}>{{d-icon "pencil-alt"}}</a>+ <a href {{on "click" this.edit}} class="edit-tag" title={{i18n "tagging.edit_tag"}}>{{d-icon "pencil-alt"}}</a>{{/if}}</div><div class="tag-description-wrapper">@@ -56,10 +56,10 @@<div class="tag-box">{{discourse-tag tag.id pmOnly=tag.pmOnly tagName="div"}}{{#if this.editSynonymsMode}}- <a href {{action "unlinkSynonym" tag}} class="unlink-synonym">+ <a href {{on "click" (fn this.unlinkSynonym tag)}} class="unlink-synonym">{{d-icon "unlink" title="tagging.remove_synonym"}}</a>- <a href {{action "deleteSynonym" tag}} class="delete-synonym">+ <a href {{on "click" (fn this.deleteSynonym tag)}} class="delete-synonym">{{d-icon "far-trash-alt" title="tagging.delete_tag"}}</a>{{/if}}diff --git a/app/assets/javascripts/discourse/app/templates/components/user-card-contents.hbs b/app/assets/javascripts/discourse/app/templates/components/user-card-contents.hbsindex f2614399f2d..eb422a5e393 100644--- a/app/assets/javascripts/discourse/app/templates/components/user-card-contents.hbs+++ b/app/assets/javascripts/discourse/app/templates/components/user-card-contents.hbs@@ -26,7 +26,7 @@{{#if this.user.profile_hidden}}<span class="card-huge-avatar">{{bound-avatar this.user "huge"}}</span>{{else}}- <a href={{this.user.path}} {{action "showUser" this.user}} class="card-huge-avatar">{{bound-avatar this.user "huge"}}</a>+ <a href={{this.user.path}} {{on "click" (fn this.handleShowUser this.user)}} class="card-huge-avatar">{{bound-avatar this.user "huge"}}</a>{{/if}}<UserAvatarFlair @user={{this.user}} />@@ -40,7 +40,7 @@{{if this.nameFirst this.user.name (format-username this.user.username)}}</span>{{else}}- <a href={{this.user.path}} {{action "showUser" this.user}} class="user-profile-link">+ <a href={{this.user.path}} {{on "click" (fn this.handleShowUser this.user)}} class="user-profile-link"><span id="discourse-user-card-title" class="name-username-wrapper">{{if this.nameFirst this.user.name (format-username this.user.username)}}</span>@@ -48,7 +48,7 @@</a>{{/if}}</h1>- <PluginOutlet @name="user-card-after-username" @connectorTagName="div" @args={{hash user=this.user showUser=(action "showUser" this.user)}} />+ <PluginOutlet @name="user-card-after-username" @connectorTagName="div" @args={{hash user=this.user showUser=(fn this.handleShowUser this.user)}} />{{#if this.nameFirst}}<h2 class="username">{{this.user.username}}</h2>{{else}}diff --git a/app/assets/javascripts/discourse/app/templates/composer.hbs b/app/assets/javascripts/discourse/app/templates/composer.hbsindex 132e37cff66..64967f99826 100644--- a/app/assets/javascripts/discourse/app/templates/composer.hbs+++ b/app/assets/javascripts/discourse/app/templates/composer.hbs@@ -101,7 +101,7 @@<ComposerSaveButton @action={{action "save"}} @icon={{this.saveIcon}} @label={{this.saveLabel}} @forwardEvent={{true}} @disableSubmit={{this.disableSubmit}} />{{#if this.site.mobileView}}- <a href {{action "cancel"}} title={{i18n "cancel"}} class="cancel">+ <a href {{on "click" this.cancel}} title={{i18n "cancel"}} class="cancel">{{#if this.canEdit}}{{d-icon "times"}}{{else}}@@ -109,7 +109,7 @@{{/if}}</a>{{else}}- <a href {{action "cancel"}} class="cancel" >{{i18n "close"}}</a>+ <a href {{on "click" this.cancel}} class="cancel" >{{i18n "close"}}</a>{{/if}}{{#if this.site.mobileView}}@@ -133,7 +133,7 @@{{/if}}{{#if this.isCancellable}}- <a href id="cancel-file-upload" {{action "cancelUpload"}}>{{d-icon "times"}}</a>+ <a href id="cancel-file-upload" {{on "click" this.cancelUpload}}>{{d-icon "times"}}</a>{{/if}}</div>{{/if}}@@ -165,7 +165,7 @@</a>{{/if}}- <a href class="btn btn-default no-text mobile-preview" title={{i18n "composer.show_preview"}} {{action "togglePreview"}} aria-label={{i18n "preview"}}>+ <a href class="btn btn-default no-text mobile-preview" title={{i18n "composer.show_preview"}} {{on "click" this.togglePreview}} aria-label={{i18n "preview"}}>{{d-icon "desktop"}}</a>@@ -180,7 +180,7 @@{{else}}<div class="saving-text">{{#if this.model.createdPost}}- {{i18n "composer.saved"}} <a href={{this.createdPost.url}} {{action "viewNewReply"}} class="permalink">{{i18n "composer.view_new_post"}}</a>+ {{i18n "composer.saved"}} <a href={{this.createdPost.url}} {{on "click" this.viewNewReply}} class="permalink">{{i18n "composer.view_new_post"}}</a>{{else}}{{i18n "composer.saving"}} {{loading-spinner size="small"}}{{/if}}diff --git a/app/assets/javascripts/discourse/app/templates/composer/dominating-topic.hbs b/app/assets/javascripts/discourse/app/templates/composer/dominating-topic.hbsindex 248e6c05a49..6edf2f0dc37 100644--- a/app/assets/javascripts/discourse/app/templates/composer/dominating-topic.hbs+++ b/app/assets/javascripts/discourse/app/templates/composer/dominating-topic.hbs@@ -1,4 +1,4 @@-<a href {{action this.closeMessage this.message}} class="close" aria-label={{i18n "composer.esc_label"}}>+<a href {{on "click" (fn this.closeMessage this.message)}} class="close" aria-label={{i18n "composer.esc_label"}}>{{i18n "composer.esc"}} {{d-icon "times"}}</a>diff --git a/app/assets/javascripts/discourse/app/templates/composer/education.hbs b/app/assets/javascripts/discourse/app/templates/composer/education.hbsindex 1c83813b006..b1d56bdaffb 100644--- a/app/assets/javascripts/discourse/app/templates/composer/education.hbs+++ b/app/assets/javascripts/discourse/app/templates/composer/education.hbs@@ -1,4 +1,4 @@-<a href {{action this.closeMessage this.message}} class="close" aria-label={{i18n "composer.esc_label"}}>+<a href {{on "click" (fn this.closeMessage this.message)}} class="close" aria-label={{i18n "composer.esc_label"}}>{{i18n "composer.esc"}} {{d-icon "times"}}</a>diff --git a/app/assets/javascripts/discourse/app/templates/composer/get-a-room.hbs b/app/assets/javascripts/discourse/app/templates/composer/get-a-room.hbsindex 308dbeefc96..f5ab6962905 100644--- a/app/assets/javascripts/discourse/app/templates/composer/get-a-room.hbs+++ b/app/assets/javascripts/discourse/app/templates/composer/get-a-room.hbs@@ -1,4 +1,4 @@-<a href {{action this.closeMessage this.message}} class="close" aria-label={{i18n "composer.esc_label"}}>+<a href {{on "click" (fn this.closeMessage this.message)}} class="close" aria-label={{i18n "composer.esc_label"}}>{{i18n "composer.esc"}} {{d-icon "times"}}</a>diff --git a/app/assets/javascripts/discourse/app/templates/composer/group-mentioned.hbs b/app/assets/javascripts/discourse/app/templates/composer/group-mentioned.hbsindex 49a28605b6a..7547ea9aa9b 100644--- a/app/assets/javascripts/discourse/app/templates/composer/group-mentioned.hbs+++ b/app/assets/javascripts/discourse/app/templates/composer/group-mentioned.hbs@@ -1,4 +1,4 @@-<a href {{action this.closeMessage this.message}} class="close" aria-label={{i18n "composer.esc_label"}}>+<a href {{on "click" (fn this.closeMessage this.message)}} class="close" aria-label={{i18n "composer.esc_label"}}>{{i18n "composer.esc"}} {{d-icon "times"}}</a>diff --git a/app/assets/javascripts/discourse/app/templates/composer/similar-topics.hbs b/app/assets/javascripts/discourse/app/templates/composer/similar-topics.hbsindex 510da64e49f..4b7b4be3097 100644--- a/app/assets/javascripts/discourse/app/templates/composer/similar-topics.hbs+++ b/app/assets/javascripts/discourse/app/templates/composer/similar-topics.hbs@@ -1,4 +1,4 @@-<a href {{action this.closeMessage this.message}} class="close" aria-label={{i18n "composer.esc_label"}}>+<a href {{on "click" (fn this.closeMessage this.message)}} class="close" aria-label={{i18n "composer.esc_label"}}>{{i18n "composer.esc"}} {{d-icon "times"}}</a>diff --git a/app/assets/javascripts/discourse/app/templates/discovery/categories.hbs b/app/assets/javascripts/discourse/app/templates/discovery/categories.hbsindex 4187cda09d5..51734fa8010 100644--- a/app/assets/javascripts/discourse/app/templates/discovery/categories.hbs+++ b/app/assets/javascripts/discourse/app/templates/discovery/categories.hbs@@ -3,7 +3,7 @@<DiscoveryCategories @refresh={{action "refresh"}}>{{#if (and this.topicTrackingState.hasIncoming this.isCategoriesRoute)}}<div class="show-more {{if this.hasTopics "has-topics"}}">- <div role="button" class="alert alert-info clickable" {{action "showInserted"}}>+ <div role="button" class="alert alert-info clickable" {{on "click" this.showInserted}}><CountI18n @key="topic_count_" @suffix={{this.topicTrackingState.filter}} @count={{this.topicTrackingState.incomingCount}} /></div></div>diff --git a/app/assets/javascripts/discourse/app/templates/discovery/topics.hbs b/app/assets/javascripts/discourse/app/templates/discovery/topics.hbsindex 7deb8d1edc0..3b6018bae95 100644--- a/app/assets/javascripts/discourse/app/templates/discovery/topics.hbs+++ b/app/assets/javascripts/discourse/app/templates/discovery/topics.hbs@@ -20,7 +20,7 @@{{else}}{{#if this.topicTrackingState.hasIncoming}}<div class="show-more {{if this.hasTopics "has-topics"}}">- <a tabindex="0" href {{action "showInserted"}} class="alert alert-info clickable">+ <a tabindex="0" href {{on "click" this.showInserted}} class="alert alert-info clickable"><CountI18n @key="topic_count_" @suffix={{this.topicTrackingState.filter}} @count={{this.topicTrackingState.incomingCount}} /></a></div>diff --git a/app/assets/javascripts/discourse/app/templates/full-page-search.hbs b/app/assets/javascripts/discourse/app/templates/full-page-search.hbsindex de59e86dae4..23926dd4608 100644--- a/app/assets/javascripts/discourse/app/templates/full-page-search.hbs+++ b/app/assets/javascripts/discourse/app/templates/full-page-search.hbs@@ -101,7 +101,7 @@<div class="no-results-suggestion">{{i18n "search.cant_find"}}{{#if this.canCreateTopic}}- <a href {{action "createTopic" this.searchTerm}}>{{i18n "search.start_new_topic"}}</a>+ <a href {{on "click" (fn this.createTopic this.searchTerm)}}>{{i18n "search.start_new_topic"}}</a>{{#unless this.siteSettings.login_required}}{{i18n "search.or_search_google"}}{{/unless}}diff --git a/app/assets/javascripts/discourse/app/templates/mobile/components/categories-only.hbs b/app/assets/javascripts/discourse/app/templates/mobile/components/categories-only.hbsindex 53f0ee38c61..a5382ff98cd 100644--- a/app/assets/javascripts/discourse/app/templates/mobile/components/categories-only.hbs+++ b/app/assets/javascripts/discourse/app/templates/mobile/components/categories-only.hbs@@ -9,7 +9,7 @@{{#if this.mutedCategories}}<div class="muted-categories">- <a href class="muted-categories-link" {{action "toggleShowMuted"}}>+ <a href class="muted-categories-link" {{on "click" this.toggleShowMuted}}><h3 class="muted-categories-heading">{{i18n "categories.muted"}}</h3>{{#if this.mutedToggleIcon}}{{d-icon this.mutedToggleIcon}}diff --git a/app/assets/javascripts/discourse/app/templates/mobile/components/mobile-nav.hbs b/app/assets/javascripts/discourse/app/templates/mobile/components/mobile-nav.hbsindex b062e88d042..6c7e389d6c0 100644--- a/app/assets/javascripts/discourse/app/templates/mobile/components/mobile-nav.hbs+++ b/app/assets/javascripts/discourse/app/templates/mobile/components/mobile-nav.hbs@@ -1,6 +1,6 @@{{#if this.selectedHtml}}<li>- <a href {{action "toggleExpanded"}} class="expander">+ <a href {{on "click" this.toggleExpanded}} class="expander"><span class="selection">{{html-safe this.selectedHtml}}</span>{{d-icon "caret-down"}}</a>diff --git a/app/assets/javascripts/discourse/app/templates/mobile/components/navigation-bar.hbs b/app/assets/javascripts/discourse/app/templates/mobile/components/navigation-bar.hbsindex 72e29f165f5..06bddeb0fac 100644--- a/app/assets/javascripts/discourse/app/templates/mobile/components/navigation-bar.hbs+++ b/app/assets/javascripts/discourse/app/templates/mobile/components/navigation-bar.hbs@@ -1,5 +1,5 @@<li class="navigation-toggle">- <a href {{action "toggleDrop"}} class="toggle-link">+ <a href {{on "click" this.toggleDrop}} class="toggle-link">{{this.selectedNavItem.displayName}}{{d-icon "caret-down"}}</a>diff --git a/app/assets/javascripts/discourse/app/templates/mobile/discovery/topics.hbs b/app/assets/javascripts/discourse/app/templates/mobile/discovery/topics.hbsindex c91dcd6405e..1e6cf38bccf 100644--- a/app/assets/javascripts/discourse/app/templates/mobile/discovery/topics.hbs+++ b/app/assets/javascripts/discourse/app/templates/mobile/discovery/topics.hbs@@ -7,7 +7,7 @@</div>{{else}}{{#if this.topicTrackingState.hasIncoming}}- <a href {{action "showInserted"}} class="alert alert-info clickable">+ <a href {{on "click" this.showInserted}} class="alert alert-info clickable"><CountI18n @key="topic_count_" @suffix={{this.topicTrackingState.filter}} @count={{this.topicTrackingState.incomingCount}} /></a>{{/if}}diff --git a/app/assets/javascripts/discourse/app/templates/mobile/modal/login.hbs b/app/assets/javascripts/discourse/app/templates/mobile/modal/login.hbsindex 8bd68ee20e8..9ac8b5d77a4 100644--- a/app/assets/javascripts/discourse/app/templates/mobile/modal/login.hbs+++ b/app/assets/javascripts/discourse/app/templates/mobile/modal/login.hbs@@ -16,7 +16,7 @@<Input @value={{this.loginName}} class={{value-entered this.loginName}} @type="email" id="login-account-name" autocorrect="off" autocapitalize="off" disabled={{this.showSecondFactor}} autofocus="autofocus" /><label class="alt-placeholder" for="login-account-name">{{i18n "login.email_placeholder"}}</label>{{#if this.showLoginWithEmailLink}}- <a href id="email-login-link" {{action (unless this.processingEmailLink "emailLogin")}}>+ <a href id="email-login-link" {{on "click" this.emailLogin}}>{{i18n "email_login.login_link"}}</a>{{/if}}@@ -24,7 +24,7 @@<div class="input-group"><Input @value={{this.loginPassword}} class={{value-entered this.loginPassword}} @type="password" id="login-account-password" maxlength="200" disabled={{this.showSecondFactor}} /><label class="alt-placeholder" for="login-account-password">{{i18n "login.password"}}</label>- <a href id="forgot-password-link" {{action "showForgotPassword"}}>{{i18n "forgot_password.action"}}</a>+ <a href id="forgot-password-link" {{on "click" this.handleForgotPassword}}>{{i18n "forgot_password.action"}}</a></div></div><SecondFactorForm @secondFactorMethod={{this.secondFactorMethod}} @secondFactorToken={{this.secondFactorToken}} @class={{this.secondFactorClass}} @backupEnabled={{this.backupEnabled}} @isLogin={{true}}>diff --git a/app/assets/javascripts/discourse/app/templates/modal/auth-token.hbs b/app/assets/javascripts/discourse/app/templates/modal/auth-token.hbsindex 86310ecef24..c0cc595e83d 100644--- a/app/assets/javascripts/discourse/app/templates/modal/auth-token.hbs+++ b/app/assets/javascripts/discourse/app/templates/modal/auth-token.hbs@@ -17,7 +17,7 @@<div><h3>{{i18n "user.auth_tokens.latest_post"}}- <a href {{action "toggleExpanded"}}>{{d-icon (if this.expanded "caret-up" "caret-down")}}</a>+ <a href {{on "click" this.toggleExpanded}}>{{d-icon (if this.expanded "caret-up" "caret-down")}}</a></h3>{{#if this.expanded}}diff --git a/app/assets/javascripts/discourse/app/templates/modal/avatar-selector.hbs b/app/assets/javascripts/discourse/app/templates/modal/avatar-selector.hbsindex d8447cfc13f..115a78dde5d 100644--- a/app/assets/javascripts/discourse/app/templates/modal/avatar-selector.hbs+++ b/app/assets/javascripts/discourse/app/templates/modal/avatar-selector.hbs@@ -2,7 +2,7 @@{{#if this.showSelectableAvatars}}<div class="selectable-avatars">{{#each this.selectableAvatars as |avatar|}}- <a href class="selectable-avatar" {{action "selectAvatar" avatar}}>+ <a href class="selectable-avatar" {{on "click" (fn this.selectAvatar avatar)}}>{{bound-avatar-template avatar "huge"}}</a>{{/each}}diff --git a/app/assets/javascripts/discourse/app/templates/modal/history.hbs b/app/assets/javascripts/discourse/app/templates/modal/history.hbsindex 38f30da9ddf..0f48b082260 100644--- a/app/assets/javascripts/discourse/app/templates/modal/history.hbs+++ b/app/assets/javascripts/discourse/app/templates/modal/history.hbs@@ -30,19 +30,19 @@<div id="display-modes"><ul class="nav nav-pills"><li>- <a href class={{this.inlineClass}} {{action "displayInline"}} title={{i18n "post.revisions.displays.inline.title"}}>+ <a href class={{this.inlineClass}} {{on "click" this.displayInline}} title={{i18n "post.revisions.displays.inline.title"}}>{{d-icon "far-square"}}{{i18n "post.revisions.displays.inline.button"}}</a></li><li>- <a href class={{this.sideBySideClass}} {{action "displaySideBySide"}} title={{i18n "post.revisions.displays.side_by_side.title"}}>+ <a href class={{this.sideBySideClass}} {{on "click" this.displaySideBySide}} title={{i18n "post.revisions.displays.side_by_side.title"}}>{{d-icon "columns"}}{{i18n "post.revisions.displays.side_by_side.button"}}</a></li><li>- <a href class={{this.sideBySideMarkdownClass}} {{action "displaySideBySideMarkdown"}} title={{i18n "post.revisions.displays.side_by_side_markdown.title"}}>+ <a href class={{this.sideBySideMarkdownClass}} {{on "click" this.displaySideBySideMarkdown}} title={{i18n "post.revisions.displays.side_by_side_markdown.title"}}>{{d-icon "columns"}}{{i18n "post.revisions.displays.side_by_side_markdown.button"}}</a>diff --git a/app/assets/javascripts/discourse/app/templates/modal/insert-hyperlink.hbs b/app/assets/javascripts/discourse/app/templates/modal/insert-hyperlink.hbsindex 52250bd8252..f93cea08071 100644--- a/app/assets/javascripts/discourse/app/templates/modal/insert-hyperlink.hbs+++ b/app/assets/javascripts/discourse/app/templates/modal/insert-hyperlink.hbs@@ -1,5 +1,5 @@<DModalBody @title="composer.link_dialog_title" @class="insert-link">- <form id="insert-hyperlink-form" {{action "ok" on="submit"}}>+ <form id="insert-hyperlink-form" {{on "submit" (action "ok")}}><div class="inputs"><TextField @value={{this.linkUrl}} @placeholderKey="composer.link_url_placeholder" @class="link-url" @key-up={{action "search"}} @autofocus="autofocus" />{{#if this.searchLoading}}diff --git a/app/assets/javascripts/discourse/app/templates/modal/login.hbs b/app/assets/javascripts/discourse/app/templates/modal/login.hbsindex 7503af7c15b..d7465134af5 100644--- a/app/assets/javascripts/discourse/app/templates/modal/login.hbs+++ b/app/assets/javascripts/discourse/app/templates/modal/login.hbs@@ -14,7 +14,7 @@<Input @value={{this.loginName}} @type="email" id="login-account-name" class={{value-entered this.loginName}} autocomplete="username" autocorrect="off" autocapitalize="off" disabled={{this.showSecondFactor}} autofocus="autofocus" tabindex="1" /><label class="alt-placeholder" for="login-account-name">{{i18n "login.email_placeholder"}}</label>{{#if this.showLoginWithEmailLink}}- <a href class={{if this.loginName "" "no-login-filled"}} tabindex="3" id="email-login-link" {{action (unless this.processingEmailLink "emailLogin")}}>+ <a href class={{if this.loginName "" "no-login-filled"}} tabindex="3" id="email-login-link" {{on "click" this.emailLogin}}>{{i18n "email_login.login_link"}}</a>{{/if}}@@ -22,7 +22,7 @@<div class="input-group"><PasswordField @value={{this.loginPassword}} @type="password" class={{value-entered this.loginPassword}} id="login-account-password" autocomplete="current-password" maxlength="200" @capsLockOn={{this.capsLockOn}} disabled={{this.disableLoginFields}} tabindex="1" /><label class="alt-placeholder" for="login-account-password">{{i18n "login.password"}}</label>- <a href id="forgot-password-link" tabindex="3" {{action "forgotPassword"}}>{{i18n "forgot_password.action"}}</a>+ <a href id="forgot-password-link" tabindex="3" {{on "click" this.handleForgotPassword}}>{{i18n "forgot_password.action"}}</a><div class="caps-lock-warning {{unless this.capsLockOn "hidden"}}">{{d-icon "exclamation-triangle"}} {{i18n "login.caps_lock_warning"}}</div></div></div>diff --git a/app/assets/javascripts/discourse/app/templates/modal/second-factor-add-totp.hbs b/app/assets/javascripts/discourse/app/templates/modal/second-factor-add-totp.hbsindex ed5c02023f7..d94537761a6 100644--- a/app/assets/javascripts/discourse/app/templates/modal/second-factor-add-totp.hbs+++ b/app/assets/javascripts/discourse/app/templates/modal/second-factor-add-totp.hbs@@ -23,7 +23,7 @@{{#if this.showSecondFactorKey}}{{this.secondFactorKey}}{{else}}- <a href {{action "showSecondFactorKey"}}>{{i18n "user.second_factor.show_key_description"}}</a>+ <a href {{on "click" this.enableShowSecondFactorKey}}>{{i18n "user.second_factor.show_key_description"}}</a>{{/if}}</p></div>diff --git a/app/assets/javascripts/discourse/app/templates/password-reset.hbs b/app/assets/javascripts/discourse/app/templates/password-reset.hbsindex 4ce19d48670..fb74ee28742 100644--- a/app/assets/javascripts/discourse/app/templates/password-reset.hbs+++ b/app/assets/javascripts/discourse/app/templates/password-reset.hbs@@ -11,7 +11,7 @@<p>{{i18n "login.not_approved"}}</p>{{else}}{{#unless this.redirected}}- <a class="btn" href={{this.redirectHref}} {{action "done"}}>{{this.continueButtonText}}</a>+ <a class="btn" href={{this.redirectHref}} {{on "click" this.done}}>{{this.continueButtonText}}</a>{{/unless}}{{/if}}{{else}}diff --git a/app/assets/javascripts/discourse/app/templates/preferences-second-factor.hbs b/app/assets/javascripts/discourse/app/templates/preferences-second-factor.hbsindex debb8266e54..166a2c81d94 100644--- a/app/assets/javascripts/discourse/app/templates/preferences-second-factor.hbs+++ b/app/assets/javascripts/discourse/app/templates/preferences-second-factor.hbs@@ -120,7 +120,7 @@<div class="controls" style="margin-top: 5px">{{this.resetPasswordProgress}}{{#unless this.resetPasswordLoading}}- <a href class="instructions" {{action "resetPassword"}}>{{ i18n "user.second_factor.forgot_password" }}</a>+ <a href class="instructions" {{on "click" this.resetPassword}}>{{ i18n "user.second_factor.forgot_password" }}</a>{{/unless}}</div></div>diff --git a/app/assets/javascripts/discourse/app/templates/preferences/account.hbs b/app/assets/javascripts/discourse/app/templates/preferences/account.hbsindex 77e3995a234..40ae04547ad 100644--- a/app/assets/javascripts/discourse/app/templates/preferences/account.hbs+++ b/app/assets/javascripts/discourse/app/templates/preferences/account.hbs@@ -53,7 +53,7 @@{{else if email.resent}}<span>{{i18n "user.email.resent_label"}}</span>{{else}}- <a {{action "resendConfirmationEmail" email}} href>{{i18n "user.email.resend_label"}}</a>+ <a {{on "click" (fn this.resendConfirmationEmail email)}} href>{{i18n "user.email.resend_label"}}</a>{{/if}}{{/unless}}</div>diff --git a/app/assets/javascripts/discourse/app/templates/preferences/security.hbs b/app/assets/javascripts/discourse/app/templates/preferences/security.hbsindex 76e2d3f63a0..78459f73e73 100644--- a/app/assets/javascripts/discourse/app/templates/preferences/security.hbs+++ b/app/assets/javascripts/discourse/app/templates/preferences/security.hbs@@ -2,7 +2,7 @@<div class="control-group pref-password"><label class="control-label">{{i18n "user.password.title"}}</label><div class="controls">- <a href {{action "changePassword"}} class="btn btn-default">+ <a href {{on "click" this.changePassword}} class="btn btn-default">{{d-icon "envelope"}}{{#if this.model.no_password}}{{i18n "user.change_password.set_password"}}@@ -58,7 +58,7 @@</div>{{#if this.canShowAllAuthTokens}}- <a href {{action "toggleShowAllAuthTokens"}}>+ <a href {{on "click" this.toggleShowAllAuthTokens}}>{{#if this.showAllAuthTokens}}{{d-icon "caret-up"}} {{i18n "user.auth_tokens.show_few"}}{{else}}@@ -67,7 +67,7 @@</a>{{/if}}- <a href {{action "revokeAuthToken"}} class="pull-right text-danger">{{d-icon "sign-out-alt"}} {{i18n "user.auth_tokens.log_out_all"}}</a>+ <a href {{on "click" (fn this.revokeAuthToken null)}} class="pull-right text-danger">{{d-icon "sign-out-alt"}} {{i18n "user.auth_tokens.log_out_all"}}</a></div>{{/if}}diff --git a/app/assets/javascripts/discourse/app/templates/second-factor-auth.hbs b/app/assets/javascripts/discourse/app/templates/second-factor-auth.hbsindex e1e99c3826e..8c38d504937 100644--- a/app/assets/javascripts/discourse/app/templates/second-factor-auth.hbs+++ b/app/assets/javascripts/discourse/app/templates/second-factor-auth.hbs@@ -25,7 +25,7 @@<span>·</span>{{/if}}<span>- <a href="" class="toggle-second-factor-method {{method.class}}" {{action "useAnotherMethod" method.id}}>+ <a href class="toggle-second-factor-method {{method.class}}" {{on "click" (fn this.useAnotherMethod method.id)}}>{{i18n method.translationKey}}</a></span>diff --git a/app/assets/javascripts/discourse/app/templates/tag/show.hbs b/app/assets/javascripts/discourse/app/templates/tag/show.hbsindex afc2d8e4dde..de725a87a48 100644--- a/app/assets/javascripts/discourse/app/templates/tag/show.hbs+++ b/app/assets/javascripts/discourse/app/templates/tag/show.hbs@@ -40,7 +40,7 @@{{else}}{{#if this.topicTrackingState.hasIncoming}}<div class="show-more {{if this.hasTopics "has-topics"}}">- <a tabindex="0" href {{action "showInserted"}} class="alert alert-info clickable">+ <a tabindex="0" href {{on "click" this.showInserted}} class="alert alert-info clickable"><CountI18n @key="topic_count_" @suffix={{this.topicTrackingState.filter}} @count={{this.topicTrackingState.incomingCount}} /></a></div>diff --git a/app/assets/javascripts/discourse/app/templates/tags/index.hbs b/app/assets/javascripts/discourse/app/templates/tags/index.hbsindex a6c07e90f19..932bcf36ec3 100644--- a/app/assets/javascripts/discourse/app/templates/tags/index.hbs+++ b/app/assets/javascripts/discourse/app/templates/tags/index.hbs@@ -15,8 +15,8 @@<div class="tag-sort-options">{{i18n "tagging.sort_by"}}- <span class="tag-sort-count {{if this.sortedByCount "active"}}"><a href {{action "sortByCount"}}>{{i18n "tagging.sort_by_count"}}</a></span>- <span class="tag-sort-name {{if this.sortedByName "active"}}"><a href {{action "sortById"}}>{{i18n "tagging.sort_by_name"}}</a></span>+ <span class="tag-sort-count {{if this.sortedByCount "active"}}"><a href {{on "click" this.sortByCount}}>{{i18n "tagging.sort_by_count"}}</a></span>+ <span class="tag-sort-name {{if this.sortedByName "active"}}"><a href {{on "click" this.sortById}}>{{i18n "tagging.sort_by_name"}}</a></span></div><hr>diff --git a/app/assets/javascripts/discourse/app/templates/topic.hbs b/app/assets/javascripts/discourse/app/templates/topic.hbsindex 41fa19fd1d5..85186edfe29 100644--- a/app/assets/javascripts/discourse/app/templates/topic.hbs+++ b/app/assets/javascripts/discourse/app/templates/topic.hbs@@ -41,7 +41,7 @@<DButton @action={{action "cancelEditingTopic"}} @class="btn-default cancel-edit" @icon="times" @ariaLabel="composer.cancel" />{{#if this.canRemoveTopicFeaturedLink}}- <a href {{action "removeFeaturedLink"}} class="remove-featured-link" title={{i18n "composer.remove_featured_link"}}>+ <a href {{on "click" this.removeFeaturedLink}} class="remove-featured-link" title={{i18n "composer.remove_featured_link"}}>{{d-icon "times-circle"}}{{this.featuredLinkDomain}}</a>@@ -61,13 +61,13 @@{{#if this.model.details.loaded}}<TopicStatus @topic={{this.model}} />- <a href={{this.model.url}} {{action "jumpTop"}} class="fancy-title">+ <a href={{this.model.url}} {{on "click" this.jumpTop}} class="fancy-title">{{html-safe this.model.fancyTitle}}</a>{{/if}}{{#if this.model.details.can_edit}}- <a href {{action "editTopic"}} class="edit-topic" title={{i18n "edit"}}>{{d-icon "pencil-alt"}}</a>+ <a href {{on "click" this.editTopic}} class="edit-topic" title={{i18n "edit"}}>{{d-icon "pencil-alt"}}</a>{{/if}}<PluginOutlet @name="topic-title-suffix" @tagName="" @args={{hash model=this.model}} />diff --git a/app/assets/javascripts/discourse/app/templates/user-private-messages-tags.hbs b/app/assets/javascripts/discourse/app/templates/user-private-messages-tags.hbsindex e4d7d361b42..c33c0d3bd11 100644--- a/app/assets/javascripts/discourse/app/templates/user-private-messages-tags.hbs+++ b/app/assets/javascripts/discourse/app/templates/user-private-messages-tags.hbs@@ -7,12 +7,12 @@<div class="tag-sort-options">{{i18n "tagging.sort_by"}}<span class="tag-sort-count {{if this.sortedByCount "active"}}">- <a href {{action "sortByCount"}}>+ <a href {{on "click" this.sortByCount}}>{{i18n "tagging.sort_by_count"}}</a></span><span class="tag-sort-name {{if this.sortedByName "active"}}">- <a href {{action "sortById"}}>+ <a href {{on "click" this.sortById}}>{{i18n "tagging.sort_by_name"}}</a></span>diff --git a/app/assets/javascripts/discourse/app/templates/user-topics-list.hbs b/app/assets/javascripts/discourse/app/templates/user-topics-list.hbsindex dc086f0c10c..6e722462809 100644--- a/app/assets/javascripts/discourse/app/templates/user-topics-list.hbs+++ b/app/assets/javascripts/discourse/app/templates/user-topics-list.hbs@@ -9,7 +9,7 @@{{#if (gt this.incomingCount 0)}}<div class="show-mores">- <a tabindex="0" href {{action "showInserted"}} class="alert alert-info clickable">+ <a tabindex="0" href {{on "click" this.showInserted}} class="alert alert-info clickable"><CountI18n @key="topic_count_" @suffix="latest" @count={{this.incomingCount}} /></a></div>diff --git a/app/assets/javascripts/discourse/app/templates/user.hbs b/app/assets/javascripts/discourse/app/templates/user.hbsindex fa522ce8b29..d036d2111eb 100644--- a/app/assets/javascripts/discourse/app/templates/user.hbs+++ b/app/assets/javascripts/discourse/app/templates/user.hbs@@ -32,7 +32,7 @@{{/if}}{{#if this.model.number_of_suspensions}}<div>- <a href {{action "showSuspensions"}}>+ <a href {{on "click" this.showSuspensions}}><span class="suspensions">{{this.model.number_of_suspensions}}</span>{{i18n "user.staff_counters.suspensions"}}</a></div>diff --git a/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-connector-class-test.js b/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-connector-class-test.jsindex 8f44b4d76ea..09f3e592261 100644--- a/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-connector-class-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-connector-class-test.js@@ -52,12 +52,12 @@ acceptance("Plugin Outlet - Connector Class", function (needs) {Ember.TEMPLATES[`${PREFIX}/user-profile-primary/hello`] = hbs`<span class='hello-username'>{{model.username}}</span>- <button class='say-hello' {{action "sayHello"}}></button>+ <button class='say-hello' {{on "click" (action "sayHello")}}></button><span class='hello-result'>{{hello}}</span>`;// eslint-disable-next-line no-undefEmber.TEMPLATES[`${PREFIX}/user-profile-primary/hi`- ] = hbs`<button class='say-hi' {{action "sayHi"}}></button>+ ] = hbs`<button class='say-hi' {{on "click" (action "sayHi")}}></button><span class='hi-result'>{{hi}}</span>`;// eslint-disable-next-line no-undefEmber.TEMPLATES[diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-menu-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-menu-test.jsindex 09f9a135f70..b9bf541d090 100644--- a/app/assets/javascripts/discourse/tests/acceptance/user-menu-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/user-menu-test.js@@ -148,25 +148,6 @@ acceptance("User menu", function (needs) {exists(".user-menu"),"clicking on the same item again closes the menu");-- await click(".d-header-icons .current-user");- await click("#user-menu-button-review-queue");- // this may not be ideal because it actually attempts to open a new tab- // which gets blocked by the browser, but otherwise it seems harmless and- // doesn't cause the test to fail. if it causes problems for you, feel free- // to remove the ctrl+click tests.- await click("#quick-access-review-queue li.reviewable.reviewed a", {- ctrlKey: true,- });- assert.strictEqual(- currentURL(),- "/review/17",- "ctrl-clicking on an item doesn't navigate to a new page"- );- assert.ok(- exists(".user-menu"),- "ctrl-clicking on an item doesn't close the menu"- );});test("tabs have title attributes", async function (assert) {diff --git a/app/assets/javascripts/discourse/tests/fixtures/concerns/notification-types.js b/app/assets/javascripts/discourse/tests/fixtures/concerns/notification-types.jsindex d5ca5e5197c..a75d7721a16 100644--- a/app/assets/javascripts/discourse/tests/fixtures/concerns/notification-types.js+++ b/app/assets/javascripts/discourse/tests/fixtures/concerns/notification-types.js@@ -1,6 +1,7 @@// DO NOT EDIT THIS FILE!!!// Update it by running `rake javascript:update_constants`+export const NOTIFICATION_TYPES = {mentioned: 1,replied: 2,diff --git a/app/assets/javascripts/discourse/tests/unit/lib/utilities-test.js b/app/assets/javascripts/discourse/tests/unit/lib/utilities-test.jsindex 6bb987c852c..c2b0c40dd86 100644--- a/app/assets/javascripts/discourse/tests/unit/lib/utilities-test.js+++ b/app/assets/javascripts/discourse/tests/unit/lib/utilities-test.js@@ -13,6 +13,7 @@ import {inCodeBlock,initializeDefaultHomepage,mergeSortedLists,+ modKeysPressed,setCaretPosition,setDefaultHomepage,slugify,@@ -25,6 +26,9 @@ import {chromeTest,discourseModule,} from "discourse/tests/helpers/qunit-helpers";+import { setupRenderingTest } from "discourse/tests/helpers/component-test";+import { click, render } from "@ember/test-helpers";+import { hbs } from "ember-cli-htmlbars";discourseModule("Unit | Utilities", function () {test("escapeExpression", function (assert) {@@ -328,6 +332,54 @@ discourseModule("Unit | Utilities", function () {"it correctly merges lists that share common items");});++ discourseModule("modKeysPressed", function (hooks) {+ setupRenderingTest(hooks);++ test("returns an array of modifier keys pressed during keyboard or mouse event", async function (assert) {+ let i = 0;++ this.handleClick = (event) => {+ if (i === 0) {+ assert.deepEqual(modKeysPressed(event), []);+ } else if (i === 1) {+ assert.deepEqual(modKeysPressed(event), ["alt"]);+ } else if (i === 2) {+ assert.deepEqual(modKeysPressed(event), ["shift"]);+ } else if (i === 3) {+ assert.deepEqual(modKeysPressed(event), ["meta"]);+ } else if (i === 4) {+ assert.deepEqual(modKeysPressed(event), ["ctrl"]);+ } else if (i === 5) {+ assert.deepEqual(modKeysPressed(event), [+ "alt",+ "shift",+ "meta",+ "ctrl",+ ]);+ }+ };++ await render(hbs`<button id="btn" {{on "click" this.handleClick}} />`);++ await click("#btn");+ i++;+ await click("#btn", { altKey: true });+ i++;+ await click("#btn", { shiftKey: true });+ i++;+ await click("#btn", { metaKey: true });+ i++;+ await click("#btn", { ctrlKey: true });+ i++;+ await click("#btn", {+ altKey: true,+ shiftKey: true,+ metaKey: true,+ ctrlKey: true,+ });+ });+ });});discourseModule("Unit | Utilities | clipboard", function (hooks) {diff --git a/app/assets/javascripts/select-kit/addon/templates/components/multi-select/selected-category.hbs b/app/assets/javascripts/select-kit/addon/templates/components/multi-select/selected-category.hbsindex ddad59ca69f..f3b1ffe1394 100644--- a/app/assets/javascripts/select-kit/addon/templates/components/multi-select/selected-category.hbs+++ b/app/assets/javascripts/select-kit/addon/templates/components/multi-select/selected-category.hbs@@ -1,4 +1,4 @@-<div {{action "onSelectedNameClick"}} tabindex="0" title={{this.title}} data-value={{this.value}} data-name={{this.name}} class="select-kit-selected-name selected-name choice">+<div {{on "click" this.onSelectedNameClick}} tabindex="0" title={{this.title}} data-value={{this.value}} data-name={{this.name}} class="select-kit-selected-name selected-name choice"><div class="body">{{this.badge}}{{d-icon "times"}}diff --git a/app/assets/javascripts/select-kit/addon/templates/components/selected-choice.hbs b/app/assets/javascripts/select-kit/addon/templates/components/selected-choice.hbsindex 8e21aee4b54..c3a26a8e0ed 100644--- a/app/assets/javascripts/select-kit/addon/templates/components/selected-choice.hbs+++ b/app/assets/javascripts/select-kit/addon/templates/components/selected-choice.hbs@@ -1,4 +1,4 @@-<button aria-label={{i18n "select_kit.delete_item" name=this.itemName}} id="{{this.id}}-choice" data-value={{this.itemValue}} data-name={{this.itemName}} type="button" {{action this.selectKit.deselect this.item}} class="btn btn-default selected-choice {{this.extraClass}}">+<button aria-label={{i18n "select_kit.delete_item" name=this.itemName}} id="{{this.id}}-choice" data-value={{this.itemValue}} data-name={{this.itemName}} type="button" {{on "click" (fn this.selectKit.deselect this.item)}} class="btn btn-default selected-choice {{this.extraClass}}">{{d-icon "times"}}{{#if (has-block)}}{{yield}}diff --git a/app/assets/javascripts/wizard/addon/components/styling-preview.js b/app/assets/javascripts/wizard/addon/components/styling-preview.jsindex cfe53afb0c6..e44bc998460 100644--- a/app/assets/javascripts/wizard/addon/components/styling-preview.js+++ b/app/assets/javascripts/wizard/addon/components/styling-preview.js@@ -205,12 +205,14 @@ export default createPreviewComponent(628, 322, {},@action- setPreviewHomepage() {+ setPreviewHomepage(event) {+ event?.preventDefault();this.set("previewTopic", false);},@action- setPreviewTopic() {+ setPreviewTopic(event) {+ event?.preventDefault();this.set("previewTopic", true);},});diff --git a/app/assets/javascripts/wizard/addon/components/wizard-step.js b/app/assets/javascripts/wizard/addon/components/wizard-step.jsindex 4e77594618c..64999e25b02 100644--- a/app/assets/javascripts/wizard/addon/components/wizard-step.js+++ b/app/assets/javascripts/wizard/addon/components/wizard-step.js@@ -134,12 +134,14 @@ export default Component.extend({},@action- quit() {+ quit(event) {+ event?.preventDefault();this.router.transitionTo("discovery.latest");},@action- exitEarly() {+ exitEarly(event) {+ event?.preventDefault();const step = this.step;step.validate();@@ -156,7 +158,9 @@ export default Component.extend({},@action- backStep() {+ backStep(event) {+ event?.preventDefault();+if (this.saving) {return;}@@ -165,7 +169,9 @@ export default Component.extend({},@action- nextStep() {+ nextStep(event) {+ event?.preventDefault();+if (this.saving) {return;}diff --git a/app/assets/javascripts/wizard/addon/templates/components/styling-preview.hbs b/app/assets/javascripts/wizard/addon/templates/components/styling-preview.hbsindex 4d49d4febdd..3c9b1736c9d 100644--- a/app/assets/javascripts/wizard/addon/templates/components/styling-preview.hbs+++ b/app/assets/javascripts/wizard/addon/templates/components/styling-preview.hbs@@ -9,10 +9,10 @@</div><div class="preview-nav">- <a href class="preview-nav-button {{if this.previewTopic "active"}}" {{action "setPreviewTopic"}}>+ <a href class="preview-nav-button {{if this.previewTopic "active"}}" {{on "click" this.setPreviewTopic}}>{{i18n "wizard.previews.topic_preview"}}</a>- <a href class="preview-nav-button {{unless this.previewTopic "active"}}" {{action "setPreviewHomepage"}}>+ <a href class="preview-nav-button {{unless this.previewTopic "active"}}" {{on "click" this.setPreviewHomepage}}>{{i18n "wizard.previews.homepage_preview"}}</a></div>diff --git a/app/assets/javascripts/wizard/addon/templates/components/wizard-step.hbs b/app/assets/javascripts/wizard/addon/templates/components/wizard-step.hbsindex 96fd2e985d5..30264766869 100644--- a/app/assets/javascripts/wizard/addon/templates/components/wizard-step.hbs+++ b/app/assets/javascripts/wizard/addon/templates/components/wizard-step.hbs@@ -49,31 +49,31 @@<div class="wizard-container__buttons">{{#if this.showNextButton}}- <button {{action "nextStep"}} disabled={{this.saving}} type="button" class="wizard-container__button primary {{this.nextButtonClass}}">+ <button {{on "click" this.nextStep}} disabled={{this.saving}} type="button" class="wizard-container__button primary {{this.nextButtonClass}}">{{i18n this.nextButtonLabel}}</button>{{/if}}{{#if this.showFinishButton}}- <button {{action "exitEarly"}} disabled={{this.saving}} type="button" class="wizard-container__button jump-in">+ <button {{on "click" this.exitEarly}} disabled={{this.saving}} type="button" class="wizard-container__button jump-in">{{i18n "wizard.jump_in"}}</button>{{/if}}{{#if this.showJumpInButton}}- <button {{action "quit"}} disabled={{this.saving}} type="button" class="wizard-container__button {{this.jumpInButtonClass}}">+ <button {{on "click" this.quit}} disabled={{this.saving}} type="button" class="wizard-container__button {{this.jumpInButtonClass}}">{{i18n this.jumpInButtonLabel}}</button>{{/if}}</div><div class="wizard-container__step-progress">- <a href {{action "backStep"}} class="wizard-container__link back {{unless this.showBackButton "inactive"}}">{{d-icon "chevron-left"}}</a>+ <a href {{on "click" this.backStep}} class="wizard-container__link back {{unless this.showBackButton "inactive"}}">{{d-icon "chevron-left"}}</a><span class="wizard-container__step-text">{{bound-i18n "wizard.step-text"}}</span><span class="wizard-container__step-count">{{bound-i18n "wizard.step" current=this.step.displayIndex total=this.wizard.totalSteps}}</span>- <a href {{action "nextStep"}} class="wizard-container__link {{unless this.showNextButton "inactive"}}">{{d-icon "chevron-right"}}</a>+ <a href {{on "click" this.nextStep}} class="wizard-container__link {{unless this.showNextButton "inactive"}}">{{d-icon "chevron-right"}}</a></div>diff --git a/lib/tasks/javascript.rake b/lib/tasks/javascript.rakeindex a09212713c3..5b473f6e5ee 100644--- a/lib/tasks/javascript.rake+++ b/lib/tasks/javascript.rake@@ -210,7 +210,7 @@ task 'javascript:update_constants' => :environment doemoji_buttons = groups_json.map do |group|<<~HTML- <button type="button" data-section="#{group["name"]}" {{action this.onCategorySelection "#{group["name"]}"}} class="btn btn-default category-button emoji">+ <button type="button" data-section="#{group["name"]}" {{on "click" (fn this.onCategorySelection "#{group["name"]}")}} class="btn btn-default category-button emoji">{{replace-emoji ":#{group["tabicon"]}:"}}</button>HTMLdiff --git a/plugins/discourse-local-dates/assets/javascripts/discourse/components/discourse-local-dates-create-form.js b/plugins/discourse-local-dates/assets/javascripts/discourse/components/discourse-local-dates-create-form.jsindex 400489e8955..426f2ab4d66 100644--- a/plugins/discourse-local-dates/assets/javascripts/discourse/components/discourse-local-dates-create-form.js+++ b/plugins/discourse-local-dates/assets/javascripts/discourse/components/discourse-local-dates-create-form.js@@ -1,7 +1,7 @@/* global Pikaday:true */import computed, { observes } from "discourse-common/utils/decorators";import Component from "@ember/component";-import EmberObject from "@ember/object";+import EmberObject, { action } from "@ember/object";import I18n from "I18n";import { INPUT_DELAY } from "discourse-common/config/environment";import { Promise } from "rsvp";@@ -306,6 +306,12 @@ export default Component.extend({return dateTime.isValid() ? dateTime.format("LLLL") : emptyText;},+ @action+ updateFormat(format, event) {+ event?.preventDefault();+ this.format = format;+ },+actions: {setTime(event) {this._setTimeIfValid(event.target.value, "time");diff --git a/plugins/discourse-local-dates/assets/javascripts/discourse/templates/components/discourse-local-dates-create-form.hbs b/plugins/discourse-local-dates/assets/javascripts/discourse/templates/components/discourse-local-dates-create-form.hbsindex 390e4ece951..d18cf61fabe 100644--- a/plugins/discourse-local-dates/assets/javascripts/discourse/templates/components/discourse-local-dates-create-form.hbs+++ b/plugins/discourse-local-dates/assets/javascripts/discourse/templates/components/discourse-local-dates-create-form.hbs@@ -115,7 +115,7 @@<ul class="formats">{{#each this.previewedFormats as |previewedFormat|}}<li class="format">- <a class="moment-format" href {{action (mut this.format) previewedFormat.format}}>+ <a class="moment-format" href {{on "click" (fn this.updateFormat previewedFormat.format)}}>{{previewedFormat.format}}</a><span class="previewed-format">diff --git a/plugins/poll/assets/javascripts/controllers/poll-ui-builder.js b/plugins/poll/assets/javascripts/controllers/poll-ui-builder.jsindex 04a51d762e6..5b4f34f4469 100644--- a/plugins/poll/assets/javascripts/controllers/poll-ui-builder.js+++ b/plugins/poll/assets/javascripts/controllers/poll-ui-builder.js@@ -398,4 +398,10 @@ export default Controller.extend(ModalFunctionality, {removeOption(option) {this.pollOptions.removeObject(option);},++ @action+ updatePollType(pollType, event) {+ event?.preventDefault();+ this.pollType = pollType;+ },});diff --git a/plugins/poll/assets/javascripts/discourse/templates/modal/poll-ui-builder.hbs b/plugins/poll/assets/javascripts/discourse/templates/modal/poll-ui-builder.hbsindex 6bfd6cb1ba1..e2f24afa90f 100644--- a/plugins/poll/assets/javascripts/discourse/templates/modal/poll-ui-builder.hbs+++ b/plugins/poll/assets/javascripts/discourse/templates/modal/poll-ui-builder.hbs@@ -1,15 +1,15 @@<DModalBody @title="poll.ui_builder.title" @class="poll-ui-builder"><div class="input-group poll-type">- <a href {{action (mut this.pollType) "regular"}} class="poll-type-value {{if this.isRegular "active"}}">+ <a href {{on "click" (fn this.updatePollType "regular")}} class="poll-type-value {{if this.isRegular "active"}}">{{i18n "poll.ui_builder.poll_type.regular"}}</a>- <a href {{action (mut this.pollType) "multiple"}} class="poll-type-value {{if this.isMultiple "active"}}">+ <a href {{on "click" (fn this.updatePollType "multiple")}} class="poll-type-value {{if this.isMultiple "active"}}">{{i18n "poll.ui_builder.poll_type.multiple"}}</a>{{#if this.showNumber}}- <a href {{action (mut this.pollType) "number"}} class="poll-type-value {{if this.isNumber "active"}}">+ <a href {{on "click" (fn this.updatePollType "number")}} class="poll-type-value {{if this.isNumber "active"}}">{{i18n "poll.ui_builder.poll_type.number"}}</a>{{/if}}