From bf1a79c9ad1c77e8ff2b86e1efea4e753bb4968d Mon Sep 17 00:00:00 2001 From: Martin Brennan Date: Fri, 28 Oct 2022 14:56:01 +1000 Subject: [PATCH] FIX: Click not opening query (#191) Due to recent core changes for Ember in https://github.com/discourse/discourse/commit/0221855ba783c6d96d2dbf2ec9f7e92b5297499b and https://github.com/discourse/discourse/commit/952b033165c2b77872d8cc79b0678dc4293c5ee1 the correct way of calling these actions must be observed, otherwise clicking on a query did nothing. This commit fixes the click and also makes scrollTop work with the new {{on X}} Ember syntax. --- .../controllers/admin-plugins-explorer.js | 16 ++++++++++------ .../templates/admin/plugins-explorer.hbs | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/assets/javascripts/discourse/controllers/admin-plugins-explorer.js b/assets/javascripts/discourse/controllers/admin-plugins-explorer.js index d40cf29..527347e 100644 --- a/assets/javascripts/discourse/controllers/admin-plugins-explorer.js +++ b/assets/javascripts/discourse/controllers/admin-plugins-explorer.js @@ -3,7 +3,10 @@ import showModal from "discourse/lib/show-modal"; import Query from "discourse/plugins/discourse-data-explorer/discourse/models/query"; import { popupAjaxError } from "discourse/lib/ajax-error"; import { ajax } from "discourse/lib/ajax"; -import discourseComputed, { observes } from "discourse-common/utils/decorators"; +import discourseComputed, { + bind, + observes, +} from "discourse-common/utils/decorators"; import I18n from "I18n"; import { Promise } from "rsvp"; import { inject as service } from "@ember/service"; @@ -165,6 +168,12 @@ export default Controller.extend({ }); }, + @bind + scrollTop() { + window.scrollTo(0, 0); + this.setProperties({ editing: false, everEditing: false }); + }, + actions: { dummy() {}, @@ -207,11 +216,6 @@ export default Controller.extend({ window.open(this.get("selectedItem.downloadUrl"), "_blank"); }, - scrollTop() { - window.scrollTo(0, 0); - this.setProperties({ editing: false, everEditing: false }); - }, - goHome() { this.setProperties({ asc: null, diff --git a/assets/javascripts/discourse/templates/admin/plugins-explorer.hbs b/assets/javascripts/discourse/templates/admin/plugins-explorer.hbs index d9b1961..9edafe0 100644 --- a/assets/javascripts/discourse/templates/admin/plugins-explorer.hbs +++ b/assets/javascripts/discourse/templates/admin/plugins-explorer.hbs @@ -346,7 +346,7 @@ {{query.name}}