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

View file

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