FIX: Reset theme install modal state on close (#11670)

The theme install modal should reset its state on close, otherwise it might cause confusion when installing multiple components successively.
This commit is contained in:
Osama Sayegh
2021-01-11 18:27:31 +03:00
committed by GitHub
parent 19cbda15e9
commit 116a879ff4
3 changed files with 69 additions and 6 deletions
@@ -26,7 +26,6 @@ export default Controller.extend(ModalFunctionality, {
checkPrivate: match("uploadUrl", /^git/),
localFile: null,
uploadUrl: null,
urlPlaceholder: "https://github.com/discourse/sample_theme",
advancedVisible: false,
selectedType: alias("themesController.currentTab"),
component: equal("selectedType", COMPONENTS),
@@ -76,12 +75,15 @@ export default Controller.extend(ModalFunctionality, {
);
},
@discourseComputed("privateChecked")
urlPlaceholder(privateChecked) {
return privateChecked
? "git@github.com:discourse/sample_theme.git"
: "https://github.com/discourse/sample_theme";
},
@observes("privateChecked")
privateWasChecked() {
this.privateChecked
? this.set("urlPlaceholder", "git@github.com:discourse/sample_theme.git")
: this.set("urlPlaceholder", "https://github.com/discourse/sample_theme");
const checked = this.privateChecked;
if (checked && !this._keyLoading) {
this._keyLoading = true;
@@ -126,7 +128,15 @@ export default Controller.extend(ModalFunctionality, {
},
onClose() {
this.set("duplicateRemoteThemeWarning", null);
this.setProperties({
duplicateRemoteThemeWarning: null,
privateChecked: false,
privateKey: null,
localFile: null,
uploadUrl: null,
publicKey: null,
branch: null,
});
},
themeHasSameUrl(theme, url) {