mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-22 20:31:19 +00:00
Dont hardcode site id in Site::update (#2110)
This commit is contained in:
parent
348077c3de
commit
fb4c47d602
1 changed files with 5 additions and 5 deletions
|
@ -42,7 +42,7 @@ impl PerformCrud for EditSite {
|
|||
// Make sure user is an admin
|
||||
is_admin(&local_user_view)?;
|
||||
|
||||
let found_site = blocking(context.pool(), Site::read_local_site).await??;
|
||||
let local_site = blocking(context.pool(), Site::read_local_site).await??;
|
||||
|
||||
let sidebar = diesel_option_overwrite(&data.sidebar);
|
||||
let description = diesel_option_overwrite(&data.description);
|
||||
|
@ -55,7 +55,7 @@ impl PerformCrud for EditSite {
|
|||
}
|
||||
|
||||
let site_form = SiteForm {
|
||||
name: data.name.to_owned().unwrap_or(found_site.name),
|
||||
name: data.name.to_owned().unwrap_or(local_site.name),
|
||||
sidebar,
|
||||
description,
|
||||
icon,
|
||||
|
@ -74,7 +74,7 @@ impl PerformCrud for EditSite {
|
|||
};
|
||||
|
||||
let update_site = blocking(context.pool(), move |conn| {
|
||||
Site::update(conn, 1, &site_form)
|
||||
Site::update(conn, local_site.id, &site_form)
|
||||
})
|
||||
.await?
|
||||
.map_err(LemmyError::from)
|
||||
|
@ -85,7 +85,7 @@ impl PerformCrud for EditSite {
|
|||
// will be able to log in. It really only wants this to be a requirement for NEW signups.
|
||||
// So if it was set from false, to true, you need to update all current users columns to be verified.
|
||||
|
||||
if !found_site.require_application && update_site.require_application {
|
||||
if !local_site.require_application && update_site.require_application {
|
||||
blocking(context.pool(), move |conn| {
|
||||
LocalUser::set_all_users_registration_applications_accepted(conn)
|
||||
})
|
||||
|
@ -94,7 +94,7 @@ impl PerformCrud for EditSite {
|
|||
.map_err(|e| e.with_message("couldnt_set_all_registrations_accepted"))?;
|
||||
}
|
||||
|
||||
if !found_site.require_email_verification && update_site.require_email_verification {
|
||||
if !local_site.require_email_verification && update_site.require_email_verification {
|
||||
blocking(context.pool(), move |conn| {
|
||||
LocalUser::set_all_users_email_verified(conn)
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue