From e175e17ebbb2a2657aece685abec4441a5719678 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Thu, 18 Feb 2021 17:34:50 +0100 Subject: [PATCH] UX: publishes page, on public change, only when page is published (#12123) --- .../javascripts/discourse/app/controllers/publish-page.js | 5 ++++- .../discourse/app/templates/modal/publish-page.hbs | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/app/controllers/publish-page.js b/app/assets/javascripts/discourse/app/controllers/publish-page.js index ef1452c3237..f237944de4b 100644 --- a/app/assets/javascripts/discourse/app/controllers/publish-page.js +++ b/app/assets/javascripts/discourse/app/controllers/publish-page.js @@ -122,6 +122,9 @@ export default Controller.extend(ModalFunctionality, StateHelpers, { @action onChangePublic(isPublic) { this.publishedPage.set("public", isPublic); - this.publish(); + + if (this.showUnpublish) { + this.publish(); + } }, }); diff --git a/app/assets/javascripts/discourse/app/templates/modal/publish-page.hbs b/app/assets/javascripts/discourse/app/templates/modal/publish-page.hbs index 9cd9a560879..94e16b22faa 100644 --- a/app/assets/javascripts/discourse/app/templates/modal/publish-page.hbs +++ b/app/assets/javascripts/discourse/app/templates/modal/publish-page.hbs @@ -23,7 +23,7 @@

{{input type="checkbox" - checked=publishedPage.public + checked=(readonly publishedPage.public) click=(action "onChangePublic" value="target.checked") }} {{i18n "topic.publish_page.public_description"}}