From 296c707f55572c8b8a28d2d2acdcf090a19c6f06 Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Thu, 10 Sep 2020 21:43:53 +0530 Subject: [PATCH] FEATURE: show existing tag name on rename modal FIX: tags_filter_regexp was not being applied on tag rename --- .../javascripts/discourse/app/controllers/rename-tag.js | 7 +++++-- .../discourse/app/templates/modal/rename-tag.hbs | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/discourse/app/controllers/rename-tag.js b/app/assets/javascripts/discourse/app/controllers/rename-tag.js index 4cf427afa49..0993aa852e1 100644 --- a/app/assets/javascripts/discourse/app/controllers/rename-tag.js +++ b/app/assets/javascripts/discourse/app/controllers/rename-tag.js @@ -3,9 +3,12 @@ import Controller from "@ember/controller"; import ModalFunctionality from "discourse/mixins/modal-functionality"; import BufferedContent from "discourse/mixins/buffered-content"; import { extractError } from "discourse/lib/ajax-error"; +import { oneWay } from "@ember/object/computed"; export default Controller.extend(ModalFunctionality, BufferedContent, { - @discourseComputed("buffered.id", "id") + tagId: oneWay("model.id"), + + @discourseComputed("tagId", "model.id") renameDisabled(inputTagName, currentTagName) { const filterRegexp = new RegExp(this.site.tags_filter_regexp, "g"); const newTagName = inputTagName @@ -18,7 +21,7 @@ export default Controller.extend(ModalFunctionality, BufferedContent, { actions: { performRename() { this.model - .update({ id: this.get("buffered.id") }) + .update({ id: this.get("tagId") }) .then((result) => { this.send("closeModal"); diff --git a/app/assets/javascripts/discourse/app/templates/modal/rename-tag.hbs b/app/assets/javascripts/discourse/app/templates/modal/rename-tag.hbs index 39d59a1da6f..ed4b9af204d 100644 --- a/app/assets/javascripts/discourse/app/templates/modal/rename-tag.hbs +++ b/app/assets/javascripts/discourse/app/templates/modal/rename-tag.hbs @@ -3,7 +3,7 @@ {{i18n "tagging.rename_instructions"}}
- {{input value=buffered.id maxlength=siteSettings.max_tag_length}} + {{input value=tagId maxlength=siteSettings.max_tag_length}}
{{/d-modal-body}}