mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-25 15:55:22 +00:00
Update AdminSettings component, fix user settings
This commit is contained in:
parent
dcc5f416ef
commit
aba1e13d43
1 changed files with 31 additions and 17 deletions
|
@ -111,7 +111,7 @@
|
||||||
<div class="card shadow-none border card-body" style="padding: 1.1rem 1.6rem">
|
<div class="card shadow-none border card-body" style="padding: 1.1rem 1.6rem">
|
||||||
<div class="form-group mb-0">
|
<div class="form-group mb-0">
|
||||||
<label for="form-summary" class="font-weight-bold">Admin Account</label>
|
<label for="form-summary" class="font-weight-bold">Admin Account</label>
|
||||||
<select v-model="landing.current_admin.id" class="form-control form-control-muted">
|
<select v-model="landing.current_admin" class="form-control form-control-muted">
|
||||||
<option disabled="" value="0">Select a designated admin</option>
|
<option disabled="" value="0">Select a designated admin</option>
|
||||||
<option v-for="(acct, index) in landing.admins" :key="'pfc-' + acct + index" :value="acct.profile_id">{{ acct.username }}</option>
|
<option v-for="(acct, index) in landing.admins" :key="'pfc-' + acct + index" :value="acct.profile_id">{{ acct.username }}</option>
|
||||||
</select>
|
</select>
|
||||||
|
@ -729,21 +729,21 @@
|
||||||
|
|
||||||
<form-input
|
<form-input
|
||||||
name="Max User Blocks"
|
name="Max User Blocks"
|
||||||
:value="users.max_user_blocks"
|
:value="users.max_user_blocks.toString()"
|
||||||
description="The max number of account blocks per user."
|
description="The max number of account blocks per user."
|
||||||
@change="handleChange($event, 'users', 'max_user_blocks')"
|
@change="handleChange($event, 'users', 'max_user_blocks')"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<form-input
|
<form-input
|
||||||
name="Max User Mutes"
|
name="Max User Mutes"
|
||||||
:value="users.max_user_mutes"
|
:value="users.max_user_mutes.toString()"
|
||||||
description="The max number of account mutes per user."
|
description="The max number of account mutes per user."
|
||||||
@change="handleChange($event, 'users', 'max_user_mutes')"
|
@change="handleChange($event, 'users', 'max_user_mutes')"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<form-input
|
<form-input
|
||||||
name="Max User Domain Blocks"
|
name="Max User Domain Blocks"
|
||||||
:value="users.max_domain_blocks"
|
:value="users.max_domain_blocks.toString()"
|
||||||
description="The max number of domain blocks per user."
|
description="The max number of domain blocks per user."
|
||||||
@change="handleChange($event, 'users', 'max_domain_blocks')"
|
@change="handleChange($event, 'users', 'max_domain_blocks')"
|
||||||
/>
|
/>
|
||||||
|
@ -794,19 +794,21 @@
|
||||||
</div>
|
</div>
|
||||||
<transition name="fade">
|
<transition name="fade">
|
||||||
<div v-if="users.admin_autofollow" class="list-group list-group-flush">
|
<div v-if="users.admin_autofollow" class="list-group list-group-flush">
|
||||||
|
<div v-if="users.admin_autofollow_accounts?.length">
|
||||||
<div v-for="user in users.admin_autofollow_accounts" class="list-group-item">
|
<div v-for="user in users.admin_autofollow_accounts" class="list-group-item">
|
||||||
<div class="d-flex justify-content-between align-items-center">
|
<div class="d-flex justify-content-between align-items-center">
|
||||||
<p class="font-weight-bold mb-0">@{{ user }}</p>
|
<p class="font-weight-bold mb-0">@{{ user }}</p>
|
||||||
<button class="btn btn-link p-0" @click.prevent="removeAutofollow(user, $event)"><i class="fas fa-trash-alt text-danger"></i></button>
|
<button class="btn btn-link p-0" @click.prevent="removeAutofollow(user, $event)"><i class="fas fa-trash-alt text-danger"></i></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="!users.admin_autofollow_accounts.length" class="list-group-item">
|
</div>
|
||||||
|
<div v-else class="list-group-item">
|
||||||
<p class="text-center mb-0">No autofollow accounts active.</p>
|
<p class="text-center mb-0">No autofollow accounts active.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</transition>
|
</transition>
|
||||||
<transition name="fade">
|
<transition name="fade">
|
||||||
<div v-if="users.admin_autofollow" class="card-footer">
|
<div v-if="users.admin_autofollow && (users.admin_autofollow_accounts && users.admin_autofollow_accounts.length < 5)" class="card-footer">
|
||||||
<button
|
<button
|
||||||
class="btn btn-primary btn-block rounded-pill"
|
class="btn btn-primary btn-block rounded-pill"
|
||||||
@click.prevent="addAutofollow">Add Autofollow Account</button>
|
@click.prevent="addAutofollow">Add Autofollow Account</button>
|
||||||
|
@ -879,7 +881,9 @@
|
||||||
isSubmittingTimeoutHandler: undefined,
|
isSubmittingTimeoutHandler: undefined,
|
||||||
|
|
||||||
features: [],
|
features: [],
|
||||||
landing: [],
|
landing: {
|
||||||
|
current_admin: 0,
|
||||||
|
},
|
||||||
branding: [],
|
branding: [],
|
||||||
media: [],
|
media: [],
|
||||||
mediaTypes: {
|
mediaTypes: {
|
||||||
|
@ -1213,6 +1217,7 @@
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
this.users.admin_autofollow_accounts = res.data.accounts;
|
this.users.admin_autofollow_accounts = res.data.accounts;
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
|
swal("Oops!", "An error occurred, please try again later!", "error");
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1233,7 +1238,7 @@
|
||||||
username: username
|
username: username
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if(!res.data.accounts.includes(username)) {
|
if(!res.data.accounts.map(acc => acc.toLowerCase()).includes(username.toLowerCase())) {
|
||||||
swal("Oops!", "The account you attempted to add does not exist or cannot be added!", "error");
|
swal("Oops!", "The account you attempted to add does not exist or cannot be added!", "error");
|
||||||
}
|
}
|
||||||
this.users.admin_autofollow_accounts = res.data.accounts;
|
this.users.admin_autofollow_accounts = res.data.accounts;
|
||||||
|
@ -1241,12 +1246,13 @@
|
||||||
swal.close();
|
swal.close();
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
if (err) {
|
if(err.response.data && err.response.data.message) {
|
||||||
swal("Oops!", "The account you attempted to add does not exist or cannot be added!", "error");
|
swal('Error', err.response.data.message, 'error');
|
||||||
} else {
|
} else {
|
||||||
|
swal("Oops!", "The account you attempted to add does not exist or cannot be added!", "error");
|
||||||
|
}
|
||||||
swal.stopLoading();
|
swal.stopLoading();
|
||||||
swal.close();
|
swal.close();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1273,7 +1279,7 @@
|
||||||
|
|
||||||
saveLanding() {
|
saveLanding() {
|
||||||
axios.post('/i/admin/api/settings/update/landing', {
|
axios.post('/i/admin/api/settings/update/landing', {
|
||||||
current_admin: this.landing.current_admin.id,
|
current_admin: this.landing.current_admin,
|
||||||
show_directory: this.landing.show_directory,
|
show_directory: this.landing.show_directory,
|
||||||
show_explore: this.landing.show_explore
|
show_explore: this.landing.show_explore
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
|
@ -1383,6 +1389,7 @@
|
||||||
require_email_verification: this.users.require_email_verification,
|
require_email_verification: this.users.require_email_verification,
|
||||||
enforce_account_limit: this.users.enforce_account_limit,
|
enforce_account_limit: this.users.enforce_account_limit,
|
||||||
admin_autofollow: this.users.admin_autofollow,
|
admin_autofollow: this.users.admin_autofollow,
|
||||||
|
admin_autofollow_accounts: this.users.admin_autofollow_accounts,
|
||||||
max_user_blocks: this.users.max_user_blocks,
|
max_user_blocks: this.users.max_user_blocks,
|
||||||
max_user_mutes: this.users.max_user_mutes,
|
max_user_mutes: this.users.max_user_mutes,
|
||||||
max_domain_blocks: this.users.max_domain_blocks,
|
max_domain_blocks: this.users.max_domain_blocks,
|
||||||
|
@ -1392,6 +1399,13 @@
|
||||||
this.isSubmittingTimeoutHandler = setTimeout(() => {
|
this.isSubmittingTimeoutHandler = setTimeout(() => {
|
||||||
this.isSubmittingTimeout = false;
|
this.isSubmittingTimeout = false;
|
||||||
}, 4000);
|
}, 4000);
|
||||||
|
}).catch(err => {
|
||||||
|
if(err.response.data.message) {
|
||||||
|
swal('Error', err.response.data.message, 'error');
|
||||||
|
} else {
|
||||||
|
swal('Error', 'An unexpected error occurred, please try again!', 'error');
|
||||||
|
}
|
||||||
|
this.isSubmitting = false;
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue