FIX: Allow CodeCommit-style theme .git url format (#12739)

This commit is contained in:
Penar Musaraj 2021-04-16 12:46:34 -04:00 committed by GitHub
parent c60ccfed98
commit 9581d71372
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 9 deletions

View File

@ -24,7 +24,7 @@ export default Controller.extend(ModalFunctionality, {
keyGenUrl: "/admin/themes/generate_key_pair", keyGenUrl: "/admin/themes/generate_key_pair",
importUrl: "/admin/themes/import", importUrl: "/admin/themes/import",
recordType: "theme", recordType: "theme",
checkPrivate: match("uploadUrl", /^.*[@].*[:].*\.git$/), checkPrivate: match("uploadUrl", /^ssh\:\/\/.*\@.*\.git$|.*\@.*\:.*\.git$/),
localFile: null, localFile: null,
uploadUrl: null, uploadUrl: null,
uploadName: null, uploadName: null,

View File

@ -80,6 +80,10 @@
<div class="label">{{i18n "admin.customize.theme.public_key"}}</div> <div class="label">{{i18n "admin.customize.theme.public_key"}}</div>
{{textarea readonly=true value=publicKey}} {{textarea readonly=true value=publicKey}}
</div> </div>
{{else}}
{{#if privateChecked}}
<div class="public-key-note">{{i18n "admin.customize.theme.public_key_note"}}</div>
{{/if}}
{{/if}} {{/if}}
{{/if}} {{/if}}
</div> </div>

View File

@ -67,8 +67,18 @@ acceptance("Admin - Themes - Install modal", function (needs) {
); );
assert.ok(query(publicKey), "shows public key"); 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"); 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) { test("modal can be auto-opened with the right query params", async function (assert) {

View File

@ -593,16 +593,19 @@
width: auto; width: auto;
margin: 3px 0; margin: 3px 0;
} }
}
.public-key { .public-key {
margin-top: 10px; margin-top: 1em;
textarea { textarea {
cursor: auto; cursor: auto;
height: 150px; min-height: 220px;
}
} }
} }
.public-key-note {
margin-top: 1em;
color: var(--primary-medium);
}
// Permalinks // Permalinks
.permalinks { .permalinks {
.url, .url,

View File

@ -4265,6 +4265,7 @@ en:
is_private: "Theme is in a private git repository" is_private: "Theme is in a private git repository"
remote_branch: "Branch name (optional)" remote_branch: "Branch name (optional)"
public_key: "Grant the following public key access to the repo:" 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" install: "Install"
installed: "Installed" installed: "Installed"
install_popular: "Popular" install_popular: "Popular"