A platform for community discussion. Free, open, simple.
FIX: Allow additional valid theme .git url formats (#12385)
Blake Erickson85870225f2d5
diff --git a/app/assets/javascripts/admin/addon/controllers/modals/admin-install-theme.js b/app/assets/javascripts/admin/addon/controllers/modals/admin-install-theme.jsindex fbef0029c60..de735c98585 100644--- a/app/assets/javascripts/admin/addon/controllers/modals/admin-install-theme.js+++ b/app/assets/javascripts/admin/addon/controllers/modals/admin-install-theme.js@@ -24,7 +24,7 @@ export default Controller.extend(ModalFunctionality, {keyGenUrl: "/admin/themes/generate_key_pair",importUrl: "/admin/themes/import",recordType: "theme",- checkPrivate: match("uploadUrl", /^git/),+ checkPrivate: match("uploadUrl", /^.*[@].*[:].*\.git$/),localFile: null,uploadUrl: null,uploadName: null,diff --git a/app/assets/javascripts/admin/tests/admin/acceptance/admin-install-theme-modal-test.js b/app/assets/javascripts/admin/tests/admin/acceptance/admin-install-theme-modal-test.jsindex f2fdfbe7a57..cee0b244df8 100644--- a/app/assets/javascripts/admin/tests/admin/acceptance/admin-install-theme-modal-test.js+++ b/app/assets/javascripts/admin/tests/admin/acceptance/admin-install-theme-modal-test.js@@ -9,6 +9,7 @@ acceptance("Admin - Themes - Install modal", function (needs) {const urlInput = ".install-theme-content .repo input";const branchInput = ".install-theme-content .branch input";const privateRepoCheckbox = ".install-theme-content .check-private input";+ const publicKey = ".install-theme-content .public-key textarea";const themeUrl = "[email protected]:discourse/discourse.git";await visit("/admin/customize/themes");@@ -29,6 +30,7 @@ acceptance("Admin - Themes - Install modal", function (needs) {query(privateRepoCheckbox).checked,"private repo checkbox is checked");+ assert.ok(query(publicKey), "shows public key");await click(".modal-footer .d-modal-cancel");@@ -40,6 +42,33 @@ acceptance("Admin - Themes - Install modal", function (needs) {!query(privateRepoCheckbox).checked,"private repo checkbox unchecked");+ assert.notOk(query(publicKey), "hide public key");+ });++ test("show public key for valid ssh theme urls", async function (assert) {+ const urlInput = ".install-theme-content .repo input";+ const privateRepoCheckbox = ".install-theme-content .check-private input";+ const publicKey = ".install-theme-content .public-key textarea";++ // Supports backlog repo ssh url format+ const themeUrl =+ "[email protected]:/TEST_THEME/test-theme.git";+ await visit("/admin/customize/themes");++ await click(".create-actions .btn-primary");+ await click("#remote");+ await fillIn(urlInput, themeUrl);+ await click(".install-theme-content .inputs .advanced-repo");+ await click(privateRepoCheckbox);+ assert.equal(query(urlInput).value, themeUrl, "url input is filled");+ assert.ok(+ query(privateRepoCheckbox).checked,+ "private repo checkbox is checked"+ );+ assert.ok(query(publicKey), "shows public key");++ await fillIn(urlInput, "https://github.com/discourse/discourse.git");+ assert.notOk(query(publicKey), "does not shows public key for https urls");});test("modal can be auto-opened with the right query params", async function (assert) {