fix(dashboard): don't overwrite current privacy settings

This commit is contained in:
Draconizations 2022-06-05 19:38:07 +02:00
parent 0046ca6859
commit c8e8655b4f
2 changed files with 11 additions and 16 deletions

View File

@ -12,19 +12,16 @@
let err: string;
let loading = false;
let allPrivacy: string;
$: { changePrivacy(allPrivacy)}
function changePrivacy(value: string) {
if (value) {
function changePrivacy(e: Event) {
const target = e.target as HTMLInputElement;
let value = target.value;
input.privacy.description_privacy = value;
input.privacy.list_privacy = value;
input.privacy.visibility = value;
input.privacy.icon_privacy = value;
input.privacy.name_privacy = value;
input.privacy.metadata_privacy = value;
}
}
const dispatch = createEventDispatcher();
@ -65,7 +62,7 @@
<Alert color="danger">{err}</Alert>
{/if}
<Label><b>Set all to:</b></Label>
<select class="form-select" bind:value={allPrivacy} use:focus aria-label="set all to">
<select class="form-select" on:change={(e) => changePrivacy(e)} use:focus aria-label="set all to">
<option>public</option>
<option>private</option>
</select>

View File

@ -12,12 +12,10 @@
let err: string;
let allPrivacy: string;
$: { changePrivacy(allPrivacy)}
function changePrivacy(value: string) {
if (value) {
function changePrivacy(e: Event) {
const target = e.target as HTMLInputElement;
let value = target.value;
input.privacy.description_privacy = value;
input.privacy.name_privacy = value;
input.privacy.avatar_privacy = value;
@ -25,7 +23,6 @@
input.privacy.pronoun_privacy = value;
input.privacy.visibility = value;
input.privacy.metadata_privacy = value;
}
}
const dispatch = createEventDispatcher();
@ -35,6 +32,7 @@
}
let input: Member = {privacy: member.privacy};
console.log(member.privacy);
async function submit() {
let data = input;
@ -67,7 +65,7 @@
<Alert color="danger">{err}</Alert>
{/if}
<Label><b>Set all to:</b></Label>
<select class="form-select" bind:value={allPrivacy} use:focus aria-label="set all to">
<select class="form-select" on:change={(e) => changePrivacy(e)} use:focus aria-label="set all to">
<option>public</option>
<option>private</option>
</select>