mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-28 16:37:44 +00:00
Add Open links in new tab setting (#3318)
* Add Open links in new tab setting * reorder because it fixes tests ?
This commit is contained in:
parent
efe98158c0
commit
b8ee9315bc
|
@ -127,6 +127,7 @@ impl Perform for SaveUserSettings {
|
||||||
.interface_language(data.interface_language.clone())
|
.interface_language(data.interface_language.clone())
|
||||||
.totp_2fa_secret(totp_2fa_secret)
|
.totp_2fa_secret(totp_2fa_secret)
|
||||||
.totp_2fa_url(totp_2fa_url)
|
.totp_2fa_url(totp_2fa_url)
|
||||||
|
.open_links_in_new_tab(data.open_links_in_new_tab)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let local_user_res = LocalUser::update(context.pool(), local_user_id, &local_user_form).await;
|
let local_user_res = LocalUser::update(context.pool(), local_user_id, &local_user_form).await;
|
||||||
|
|
|
@ -131,6 +131,8 @@ pub struct SaveUserSettings {
|
||||||
/// None leaves it as is, true will generate or regenerate it, false clears it out.
|
/// None leaves it as is, true will generate or regenerate it, false clears it out.
|
||||||
pub generate_totp_2fa: Option<bool>,
|
pub generate_totp_2fa: Option<bool>,
|
||||||
pub auth: Sensitive<String>,
|
pub auth: Sensitive<String>,
|
||||||
|
/// Open links in a new tab
|
||||||
|
pub open_links_in_new_tab: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
||||||
|
|
|
@ -406,6 +406,7 @@ diesel::table! {
|
||||||
accepted_application -> Bool,
|
accepted_application -> Bool,
|
||||||
totp_2fa_secret -> Nullable<Text>,
|
totp_2fa_secret -> Nullable<Text>,
|
||||||
totp_2fa_url -> Nullable<Text>,
|
totp_2fa_url -> Nullable<Text>,
|
||||||
|
open_links_in_new_tab -> Bool,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,8 @@ pub struct LocalUser {
|
||||||
pub totp_2fa_secret: Option<String>,
|
pub totp_2fa_secret: Option<String>,
|
||||||
/// A URL to add their 2-factor auth.
|
/// A URL to add their 2-factor auth.
|
||||||
pub totp_2fa_url: Option<String>,
|
pub totp_2fa_url: Option<String>,
|
||||||
|
/// Open links in a new tab.
|
||||||
|
pub open_links_in_new_tab: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, TypedBuilder)]
|
#[derive(Clone, TypedBuilder)]
|
||||||
|
@ -78,6 +80,7 @@ pub struct LocalUserInsertForm {
|
||||||
pub accepted_application: Option<bool>,
|
pub accepted_application: Option<bool>,
|
||||||
pub totp_2fa_secret: Option<Option<String>>,
|
pub totp_2fa_secret: Option<Option<String>>,
|
||||||
pub totp_2fa_url: Option<Option<String>>,
|
pub totp_2fa_url: Option<Option<String>>,
|
||||||
|
pub open_links_in_new_tab: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, TypedBuilder)]
|
#[derive(Clone, TypedBuilder)]
|
||||||
|
@ -102,4 +105,5 @@ pub struct LocalUserUpdateForm {
|
||||||
pub accepted_application: Option<bool>,
|
pub accepted_application: Option<bool>,
|
||||||
pub totp_2fa_secret: Option<Option<String>>,
|
pub totp_2fa_secret: Option<Option<String>>,
|
||||||
pub totp_2fa_url: Option<Option<String>>,
|
pub totp_2fa_url: Option<Option<String>>,
|
||||||
|
pub open_links_in_new_tab: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -287,6 +287,7 @@ mod tests {
|
||||||
totp_2fa_secret: inserted_sara_local_user.totp_2fa_secret,
|
totp_2fa_secret: inserted_sara_local_user.totp_2fa_secret,
|
||||||
totp_2fa_url: inserted_sara_local_user.totp_2fa_url,
|
totp_2fa_url: inserted_sara_local_user.totp_2fa_url,
|
||||||
password_encrypted: inserted_sara_local_user.password_encrypted,
|
password_encrypted: inserted_sara_local_user.password_encrypted,
|
||||||
|
open_links_in_new_tab: inserted_sara_local_user.open_links_in_new_tab,
|
||||||
},
|
},
|
||||||
creator: Person {
|
creator: Person {
|
||||||
id: inserted_sara_person.id,
|
id: inserted_sara_person.id,
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
alter table local_user drop column open_links_in_new_tab;
|
|
@ -0,0 +1 @@
|
||||||
|
alter table local_user add column open_links_in_new_tab boolean default false not null;
|
Loading…
Reference in a new issue