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.js index de735c98585..df91acd0943 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", /^ssh\:\/\/.*\@.*\.git$|.*\@.*\:.*\.git$/), localFile: null, uploadUrl: null, uploadName: null, diff --git a/app/assets/javascripts/admin/addon/templates/modal/admin-install-theme.hbs b/app/assets/javascripts/admin/addon/templates/modal/admin-install-theme.hbs index 5f09f339703..2fda0a1b009 100644 --- a/app/assets/javascripts/admin/addon/templates/modal/admin-install-theme.hbs +++ b/app/assets/javascripts/admin/addon/templates/modal/admin-install-theme.hbs @@ -80,6 +80,10 @@
{{i18n "admin.customize.theme.public_key"}}
{{textarea readonly=true value=publicKey}} + {{else}} + {{#if privateChecked}} +
{{i18n "admin.customize.theme.public_key_note"}}
+ {{/if}} {{/if}} {{/if}} diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-install-theme-modal-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-install-theme-modal-test.js index cee0b244df8..8c85c6e6250 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/admin-install-theme-modal-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/admin-install-theme-modal-test.js @@ -67,8 +67,18 @@ acceptance("Admin - Themes - Install modal", function (needs) { ); assert.ok(query(publicKey), "shows public key"); + // Supports AWS CodeCommit style repo URLs + await fillIn( + urlInput, + "ssh://someID@git-codecommit.us-west-2.amazonaws.com/v1/repos/test-repo.git" + ); + 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"); + assert.notOk(query(publicKey), "does not show public key for https urls"); + + await fillIn(urlInput, "git@github.com:discourse/discourse.git"); + assert.ok(query(publicKey), "shows public key for valid github repo url"); }); test("modal can be auto-opened with the right query params", async function (assert) { diff --git a/app/assets/stylesheets/common/admin/customize.scss b/app/assets/stylesheets/common/admin/customize.scss index 5aad5286aed..8fe711b91cc 100644 --- a/app/assets/stylesheets/common/admin/customize.scss +++ b/app/assets/stylesheets/common/admin/customize.scss @@ -593,16 +593,19 @@ width: auto; margin: 3px 0; } - - .public-key { - margin-top: 10px; - textarea { - cursor: auto; - height: 150px; - } +} +.public-key { + margin-top: 1em; + textarea { + cursor: auto; + min-height: 220px; } } +.public-key-note { + margin-top: 1em; + color: var(--primary-medium); +} // Permalinks .permalinks { .url, diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 3b41ff765e5..66a61de790f 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -4265,6 +4265,7 @@ en: is_private: "Theme is in a private git repository" remote_branch: "Branch name (optional)" public_key: "Grant the following public key access to the repo:" + public_key_note: "After entering a valid private repository URL above, an SSH key will be generated and displayed here." install: "Install" installed: "Installed" install_popular: "Popular"