Add "manually_approves_followers" column to actor_profile table
This commit is contained in:
parent
0b65e7473e
commit
c80bfccd6a
7 changed files with 34 additions and 9 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE actor_profile ADD COLUMN manually_approves_followers BOOLEAN NOT NULL DEFAULT FALSE;
|
||||||
|
ALTER TABLE actor_profile ALTER COLUMN manually_approves_followers DROP DEFAULT;
|
|
@ -26,6 +26,7 @@ CREATE TABLE actor_profile (
|
||||||
bio_source TEXT,
|
bio_source TEXT,
|
||||||
avatar JSONB,
|
avatar JSONB,
|
||||||
banner JSONB,
|
banner JSONB,
|
||||||
|
manually_approves_followers BOOLEAN NOT NULL,
|
||||||
identity_proofs JSONB NOT NULL DEFAULT '[]',
|
identity_proofs JSONB NOT NULL DEFAULT '[]',
|
||||||
payment_options JSONB NOT NULL DEFAULT '[]',
|
payment_options JSONB NOT NULL DEFAULT '[]',
|
||||||
extra_fields JSONB NOT NULL DEFAULT '[]',
|
extra_fields JSONB NOT NULL DEFAULT '[]',
|
||||||
|
|
|
@ -149,6 +149,7 @@ pub async fn create_remote_profile(
|
||||||
bio: actor.summary.clone(),
|
bio: actor.summary.clone(),
|
||||||
avatar: maybe_avatar,
|
avatar: maybe_avatar,
|
||||||
banner: maybe_banner,
|
banner: maybe_banner,
|
||||||
|
manually_approves_followers: actor.manually_approves_followers,
|
||||||
identity_proofs,
|
identity_proofs,
|
||||||
payment_options,
|
payment_options,
|
||||||
extra_fields,
|
extra_fields,
|
||||||
|
@ -204,6 +205,7 @@ pub async fn update_remote_profile(
|
||||||
bio_source: actor.summary.clone(),
|
bio_source: actor.summary.clone(),
|
||||||
avatar: maybe_avatar,
|
avatar: maybe_avatar,
|
||||||
banner: maybe_banner,
|
banner: maybe_banner,
|
||||||
|
manually_approves_followers: actor.manually_approves_followers,
|
||||||
identity_proofs,
|
identity_proofs,
|
||||||
payment_options,
|
payment_options,
|
||||||
extra_fields,
|
extra_fields,
|
||||||
|
|
|
@ -132,6 +132,7 @@ impl Account {
|
||||||
.map(|image| get_file_url(base_url, &image.file_name));
|
.map(|image| get_file_url(base_url, &image.file_name));
|
||||||
let header_url = profile.banner
|
let header_url = profile.banner
|
||||||
.map(|image| get_file_url(base_url, &image.file_name));
|
.map(|image| get_file_url(base_url, &image.file_name));
|
||||||
|
// TODO: use profile.manually_approves_followers
|
||||||
let is_locked = profile.actor_json
|
let is_locked = profile.actor_json
|
||||||
.map(|actor| actor.manually_approves_followers)
|
.map(|actor| actor.manually_approves_followers)
|
||||||
.unwrap_or(false);
|
.unwrap_or(false);
|
||||||
|
@ -367,6 +368,7 @@ impl AccountUpdateData {
|
||||||
bio_source: self.note,
|
bio_source: self.note,
|
||||||
avatar,
|
avatar,
|
||||||
banner,
|
banner,
|
||||||
|
manually_approves_followers: false,
|
||||||
identity_proofs,
|
identity_proofs,
|
||||||
payment_options,
|
payment_options,
|
||||||
extra_fields,
|
extra_fields,
|
||||||
|
|
|
@ -133,12 +133,21 @@ pub async fn create_profile(
|
||||||
transaction.execute(
|
transaction.execute(
|
||||||
"
|
"
|
||||||
INSERT INTO actor_profile (
|
INSERT INTO actor_profile (
|
||||||
id, username, hostname, display_name, bio, bio_source,
|
id,
|
||||||
avatar, banner,
|
username,
|
||||||
identity_proofs, payment_options, extra_fields,
|
hostname,
|
||||||
|
display_name,
|
||||||
|
bio,
|
||||||
|
bio_source,
|
||||||
|
avatar,
|
||||||
|
banner,
|
||||||
|
manually_approves_followers,
|
||||||
|
identity_proofs,
|
||||||
|
payment_options,
|
||||||
|
extra_fields,
|
||||||
actor_json
|
actor_json
|
||||||
)
|
)
|
||||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)
|
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)
|
||||||
RETURNING actor_profile
|
RETURNING actor_profile
|
||||||
",
|
",
|
||||||
&[
|
&[
|
||||||
|
@ -150,6 +159,7 @@ pub async fn create_profile(
|
||||||
&profile_data.bio,
|
&profile_data.bio,
|
||||||
&profile_data.avatar,
|
&profile_data.avatar,
|
||||||
&profile_data.banner,
|
&profile_data.banner,
|
||||||
|
&profile_data.manually_approves_followers,
|
||||||
&IdentityProofs(profile_data.identity_proofs),
|
&IdentityProofs(profile_data.identity_proofs),
|
||||||
&PaymentOptions(profile_data.payment_options),
|
&PaymentOptions(profile_data.payment_options),
|
||||||
&ExtraFields(profile_data.extra_fields),
|
&ExtraFields(profile_data.extra_fields),
|
||||||
|
@ -184,12 +194,13 @@ pub async fn update_profile(
|
||||||
bio_source = $3,
|
bio_source = $3,
|
||||||
avatar = $4,
|
avatar = $4,
|
||||||
banner = $5,
|
banner = $5,
|
||||||
identity_proofs = $6,
|
manually_approves_followers = $6,
|
||||||
payment_options = $7,
|
identity_proofs = $7,
|
||||||
extra_fields = $8,
|
payment_options = $8,
|
||||||
actor_json = $9,
|
extra_fields = $9,
|
||||||
|
actor_json = $10,
|
||||||
updated_at = CURRENT_TIMESTAMP
|
updated_at = CURRENT_TIMESTAMP
|
||||||
WHERE id = $10
|
WHERE id = $11
|
||||||
RETURNING actor_profile
|
RETURNING actor_profile
|
||||||
",
|
",
|
||||||
&[
|
&[
|
||||||
|
@ -198,6 +209,7 @@ pub async fn update_profile(
|
||||||
&profile_data.bio_source,
|
&profile_data.bio_source,
|
||||||
&profile_data.avatar,
|
&profile_data.avatar,
|
||||||
&profile_data.banner,
|
&profile_data.banner,
|
||||||
|
&profile_data.manually_approves_followers,
|
||||||
&IdentityProofs(profile_data.identity_proofs),
|
&IdentityProofs(profile_data.identity_proofs),
|
||||||
&PaymentOptions(profile_data.payment_options),
|
&PaymentOptions(profile_data.payment_options),
|
||||||
&ExtraFields(profile_data.extra_fields),
|
&ExtraFields(profile_data.extra_fields),
|
||||||
|
|
|
@ -333,6 +333,7 @@ pub struct DbActorProfile {
|
||||||
pub bio_source: Option<String>, // plaintext or markdown
|
pub bio_source: Option<String>, // plaintext or markdown
|
||||||
pub avatar: Option<ProfileImage>,
|
pub avatar: Option<ProfileImage>,
|
||||||
pub banner: Option<ProfileImage>,
|
pub banner: Option<ProfileImage>,
|
||||||
|
pub manually_approves_followers: bool,
|
||||||
pub identity_proofs: IdentityProofs,
|
pub identity_proofs: IdentityProofs,
|
||||||
pub payment_options: PaymentOptions,
|
pub payment_options: PaymentOptions,
|
||||||
pub extra_fields: ExtraFields,
|
pub extra_fields: ExtraFields,
|
||||||
|
@ -421,6 +422,7 @@ impl Default for DbActorProfile {
|
||||||
bio_source: None,
|
bio_source: None,
|
||||||
avatar: None,
|
avatar: None,
|
||||||
banner: None,
|
banner: None,
|
||||||
|
manually_approves_followers: false,
|
||||||
identity_proofs: IdentityProofs(vec![]),
|
identity_proofs: IdentityProofs(vec![]),
|
||||||
payment_options: PaymentOptions(vec![]),
|
payment_options: PaymentOptions(vec![]),
|
||||||
extra_fields: ExtraFields(vec![]),
|
extra_fields: ExtraFields(vec![]),
|
||||||
|
@ -446,6 +448,7 @@ pub struct ProfileCreateData {
|
||||||
pub bio: Option<String>,
|
pub bio: Option<String>,
|
||||||
pub avatar: Option<ProfileImage>,
|
pub avatar: Option<ProfileImage>,
|
||||||
pub banner: Option<ProfileImage>,
|
pub banner: Option<ProfileImage>,
|
||||||
|
pub manually_approves_followers: bool,
|
||||||
pub identity_proofs: Vec<IdentityProof>,
|
pub identity_proofs: Vec<IdentityProof>,
|
||||||
pub payment_options: Vec<PaymentOption>,
|
pub payment_options: Vec<PaymentOption>,
|
||||||
pub extra_fields: Vec<ExtraField>,
|
pub extra_fields: Vec<ExtraField>,
|
||||||
|
@ -478,6 +481,7 @@ pub struct ProfileUpdateData {
|
||||||
pub bio_source: Option<String>,
|
pub bio_source: Option<String>,
|
||||||
pub avatar: Option<ProfileImage>,
|
pub avatar: Option<ProfileImage>,
|
||||||
pub banner: Option<ProfileImage>,
|
pub banner: Option<ProfileImage>,
|
||||||
|
pub manually_approves_followers: bool,
|
||||||
pub identity_proofs: Vec<IdentityProof>,
|
pub identity_proofs: Vec<IdentityProof>,
|
||||||
pub payment_options: Vec<PaymentOption>,
|
pub payment_options: Vec<PaymentOption>,
|
||||||
pub extra_fields: Vec<ExtraField>,
|
pub extra_fields: Vec<ExtraField>,
|
||||||
|
@ -526,6 +530,7 @@ impl From<&DbActorProfile> for ProfileUpdateData {
|
||||||
bio_source: profile.bio_source,
|
bio_source: profile.bio_source,
|
||||||
avatar: profile.avatar,
|
avatar: profile.avatar,
|
||||||
banner: profile.banner,
|
banner: profile.banner,
|
||||||
|
manually_approves_followers: profile.manually_approves_followers,
|
||||||
identity_proofs: profile.identity_proofs.into_inner(),
|
identity_proofs: profile.identity_proofs.into_inner(),
|
||||||
payment_options: profile.payment_options.into_inner(),
|
payment_options: profile.payment_options.into_inner(),
|
||||||
extra_fields: profile.extra_fields.into_inner(),
|
extra_fields: profile.extra_fields.into_inner(),
|
||||||
|
|
|
@ -114,6 +114,7 @@ pub async fn create_user(
|
||||||
bio: None,
|
bio: None,
|
||||||
avatar: None,
|
avatar: None,
|
||||||
banner: None,
|
banner: None,
|
||||||
|
manually_approves_followers: false,
|
||||||
identity_proofs: vec![],
|
identity_proofs: vec![],
|
||||||
payment_options: vec![],
|
payment_options: vec![],
|
||||||
extra_fields: vec![],
|
extra_fields: vec![],
|
||||||
|
|
Loading…
Reference in a new issue