web/admin: fix source type not always matching modelname

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-06-01 23:16:36 +02:00
parent 5bebf26908
commit 3af48a81e2
1 changed files with 3 additions and 1 deletions

View File

@ -199,8 +199,10 @@ export class OAuthSourceForm extends ModelForm<OAuthSource, string> {
${until(new SourcesApi(DEFAULT_CONFIG).sourcesOauthSourceTypesList().then(types => {
return types.map(type => {
let selected = this.instance?.providerType === type.slug;
const modelSlug = this.modelName?.replace("oauthsource", "").replace("-", "");
const typeSlug = type.slug.replace("-", "");
if (!this.instance?.pk) {
if (this.modelName?.replace("oauthsource", "") === type.slug) {
if (modelSlug === typeSlug) {
selected = true;
}
}