Merge branch 'main' into actor-name-length-config

This commit is contained in:
Dessalines 2021-07-22 19:20:48 -04:00
commit 4ebddab10b
9 changed files with 13 additions and 1 deletions

View file

@ -241,6 +241,7 @@ impl Perform for SaveUserSettings {
lang: data.lang.to_owned(), lang: data.lang.to_owned(),
show_avatars: data.show_avatars, show_avatars: data.show_avatars,
show_read_posts: data.show_read_posts, show_read_posts: data.show_read_posts,
show_new_post_notifs: data.show_new_post_notifs,
send_notifications_to_email: data.send_notifications_to_email, send_notifications_to_email: data.send_notifications_to_email,
}; };

View file

@ -63,6 +63,7 @@ pub struct SaveUserSettings {
pub bot_account: Option<bool>, pub bot_account: Option<bool>,
pub show_bot_accounts: Option<bool>, pub show_bot_accounts: Option<bool>,
pub show_read_posts: Option<bool>, pub show_read_posts: Option<bool>,
pub show_new_post_notifs: Option<bool>,
pub auth: String, pub auth: String,
} }

View file

@ -118,6 +118,7 @@ impl PerformCrud for Register {
.map_err(|_| ApiError::err("user_already_exists"))?; .map_err(|_| ApiError::err("user_already_exists"))?;
// Create the local user // Create the local user
// TODO some of these could probably use the DB defaults
let local_user_form = LocalUserForm { let local_user_form = LocalUserForm {
person_id: inserted_person.id, person_id: inserted_person.id,
email: Some(data.email.to_owned()), email: Some(data.email.to_owned()),
@ -131,6 +132,7 @@ impl PerformCrud for Register {
show_avatars: Some(true), show_avatars: Some(true),
show_scores: Some(true), show_scores: Some(true),
show_read_posts: Some(true), show_read_posts: Some(true),
show_new_post_notifs: Some(false),
send_notifications_to_email: Some(false), send_notifications_to_email: Some(false),
}; };

View file

@ -349,7 +349,7 @@ pub fn build_actor_id_from_shortname(
let domain = if split.len() == 1 { let domain = if split.len() == 1 {
Settings::get().get_protocol_and_hostname() Settings::get().get_protocol_and_hostname()
} else { } else {
format!("https://{}", split[1]) format!("{}://{}", Settings::get().get_protocol_string(), split[1])
}; };
generate_apub_endpoint_for_domain(endpoint_type, name, &domain) generate_apub_endpoint_for_domain(endpoint_type, name, &domain)

View file

@ -27,6 +27,7 @@ mod safe_settings_type {
show_bot_accounts, show_bot_accounts,
show_scores, show_scores,
show_read_posts, show_read_posts,
show_new_post_notifs,
); );
impl ToSafeSettings for LocalUser { impl ToSafeSettings for LocalUser {
@ -49,6 +50,7 @@ mod safe_settings_type {
show_bot_accounts, show_bot_accounts,
show_scores, show_scores,
show_read_posts, show_read_posts,
show_new_post_notifs,
) )
} }
} }

View file

@ -156,6 +156,7 @@ table! {
show_bot_accounts -> Bool, show_bot_accounts -> Bool,
show_scores -> Bool, show_scores -> Bool,
show_read_posts -> Bool, show_read_posts -> Bool,
show_new_post_notifs -> Bool,
} }
} }

View file

@ -19,6 +19,7 @@ pub struct LocalUser {
pub show_bot_accounts: bool, pub show_bot_accounts: bool,
pub show_scores: bool, pub show_scores: bool,
pub show_read_posts: bool, pub show_read_posts: bool,
pub show_new_post_notifs: bool,
} }
// TODO redo these, check table defaults // TODO redo these, check table defaults
@ -38,6 +39,7 @@ pub struct LocalUserForm {
pub show_bot_accounts: Option<bool>, pub show_bot_accounts: Option<bool>,
pub show_scores: Option<bool>, pub show_scores: Option<bool>,
pub show_read_posts: Option<bool>, pub show_read_posts: Option<bool>,
pub show_new_post_notifs: Option<bool>,
} }
/// A local user view that removes password encrypted /// A local user view that removes password encrypted
@ -58,4 +60,5 @@ pub struct LocalUserSettings {
pub show_bot_accounts: bool, pub show_bot_accounts: bool,
pub show_scores: bool, pub show_scores: bool,
pub show_read_posts: bool, pub show_read_posts: bool,
pub show_new_post_notifs: bool,
} }

View file

@ -0,0 +1 @@
alter table local_user drop column show_new_post_notifs;

View file

@ -0,0 +1 @@
alter table local_user add column show_new_post_notifs boolean default false not null;