mirror of
https://github.com/LemmyNet/lemmy
synced 2024-11-15 12:13:04 +00:00
Dropping default on pending column.
This commit is contained in:
parent
d4ee171b08
commit
3c111b3062
@ -76,7 +76,7 @@ impl Perform for BanFromCommunity {
|
|||||||
let community_follower_form = CommunityFollowerForm {
|
let community_follower_form = CommunityFollowerForm {
|
||||||
community_id: data.community_id,
|
community_id: data.community_id,
|
||||||
person_id: banned_person_id,
|
person_id: banned_person_id,
|
||||||
pending: Some(false),
|
pending: false,
|
||||||
};
|
};
|
||||||
blocking(context.pool(), move |conn: &'_ _| {
|
blocking(context.pool(), move |conn: &'_ _| {
|
||||||
CommunityFollower::unfollow(conn, &community_follower_form)
|
CommunityFollower::unfollow(conn, &community_follower_form)
|
||||||
|
@ -47,7 +47,7 @@ impl Perform for BlockCommunity {
|
|||||||
let community_follower_form = CommunityFollowerForm {
|
let community_follower_form = CommunityFollowerForm {
|
||||||
community_id: data.community_id,
|
community_id: data.community_id,
|
||||||
person_id,
|
person_id,
|
||||||
pending: Some(false),
|
pending: false,
|
||||||
};
|
};
|
||||||
blocking(context.pool(), move |conn: &'_ _| {
|
blocking(context.pool(), move |conn: &'_ _| {
|
||||||
CommunityFollower::unfollow(conn, &community_follower_form)
|
CommunityFollower::unfollow(conn, &community_follower_form)
|
||||||
|
@ -47,7 +47,7 @@ impl Perform for FollowCommunity {
|
|||||||
let community_follower_form = CommunityFollowerForm {
|
let community_follower_form = CommunityFollowerForm {
|
||||||
community_id: data.community_id,
|
community_id: data.community_id,
|
||||||
person_id: local_user_view.person.id,
|
person_id: local_user_view.person.id,
|
||||||
pending: Some(false), // Don't worry, this form isn't used for remote follows
|
pending: false, // Don't worry, this form isn't used for remote follows
|
||||||
};
|
};
|
||||||
|
|
||||||
if community.local {
|
if community.local {
|
||||||
|
@ -123,7 +123,7 @@ impl PerformCrud for CreateCommunity {
|
|||||||
let community_follower_form = CommunityFollowerForm {
|
let community_follower_form = CommunityFollowerForm {
|
||||||
community_id: inserted_community.id,
|
community_id: inserted_community.id,
|
||||||
person_id: local_user_view.person.id,
|
person_id: local_user_view.person.id,
|
||||||
pending: Some(false),
|
pending: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
let follow = move |conn: &'_ _| CommunityFollower::follow(conn, &community_follower_form);
|
let follow = move |conn: &'_ _| CommunityFollower::follow(conn, &community_follower_form);
|
||||||
|
@ -232,7 +232,7 @@ impl PerformCrud for Register {
|
|||||||
let community_follower_form = CommunityFollowerForm {
|
let community_follower_form = CommunityFollowerForm {
|
||||||
community_id: main_community.id,
|
community_id: main_community.id,
|
||||||
person_id: inserted_person.id,
|
person_id: inserted_person.id,
|
||||||
pending: Some(false),
|
pending: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
let follow = move |conn: &'_ _| CommunityFollower::follow(conn, &community_follower_form);
|
let follow = move |conn: &'_ _| CommunityFollower::follow(conn, &community_follower_form);
|
||||||
|
@ -200,7 +200,7 @@ impl ActivityHandler for BlockUser {
|
|||||||
let community_follower_form = CommunityFollowerForm {
|
let community_follower_form = CommunityFollowerForm {
|
||||||
community_id: community.id,
|
community_id: community.id,
|
||||||
person_id: blocked_person.id,
|
person_id: blocked_person.id,
|
||||||
pending: Some(false),
|
pending: false,
|
||||||
};
|
};
|
||||||
blocking(context.pool(), move |conn: &'_ _| {
|
blocking(context.pool(), move |conn: &'_ _| {
|
||||||
CommunityFollower::unfollow(conn, &community_follower_form)
|
CommunityFollower::unfollow(conn, &community_follower_form)
|
||||||
|
@ -50,7 +50,7 @@ impl FollowCommunity {
|
|||||||
let community_follower_form = CommunityFollowerForm {
|
let community_follower_form = CommunityFollowerForm {
|
||||||
community_id: community.id,
|
community_id: community.id,
|
||||||
person_id: actor.id,
|
person_id: actor.id,
|
||||||
pending: Some(true),
|
pending: true,
|
||||||
};
|
};
|
||||||
blocking(context.pool(), move |conn| {
|
blocking(context.pool(), move |conn| {
|
||||||
CommunityFollower::follow(conn, &community_follower_form).ok()
|
CommunityFollower::follow(conn, &community_follower_form).ok()
|
||||||
@ -100,7 +100,7 @@ impl ActivityHandler for FollowCommunity {
|
|||||||
let community_follower_form = CommunityFollowerForm {
|
let community_follower_form = CommunityFollowerForm {
|
||||||
community_id: community.id,
|
community_id: community.id,
|
||||||
person_id: person.id,
|
person_id: person.id,
|
||||||
pending: Some(false),
|
pending: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
// This will fail if they're already a follower, but ignore the error.
|
// This will fail if they're already a follower, but ignore the error.
|
||||||
|
@ -77,7 +77,7 @@ impl ActivityHandler for UndoFollowCommunity {
|
|||||||
let community_follower_form = CommunityFollowerForm {
|
let community_follower_form = CommunityFollowerForm {
|
||||||
community_id: community.id,
|
community_id: community.id,
|
||||||
person_id: person.id,
|
person_id: person.id,
|
||||||
pending: Some(false),
|
pending: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
// This will fail if they aren't a follower, but ignore the error.
|
// This will fail if they aren't a follower, but ignore the error.
|
||||||
|
@ -66,7 +66,7 @@ mod tests {
|
|||||||
let first_person_follow = CommunityFollowerForm {
|
let first_person_follow = CommunityFollowerForm {
|
||||||
community_id: inserted_community.id,
|
community_id: inserted_community.id,
|
||||||
person_id: inserted_person.id,
|
person_id: inserted_person.id,
|
||||||
pending: Some(false),
|
pending: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
CommunityFollower::follow(&conn, &first_person_follow).unwrap();
|
CommunityFollower::follow(&conn, &first_person_follow).unwrap();
|
||||||
@ -74,7 +74,7 @@ mod tests {
|
|||||||
let second_person_follow = CommunityFollowerForm {
|
let second_person_follow = CommunityFollowerForm {
|
||||||
community_id: inserted_community.id,
|
community_id: inserted_community.id,
|
||||||
person_id: another_inserted_person.id,
|
person_id: another_inserted_person.id,
|
||||||
pending: Some(false),
|
pending: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
CommunityFollower::follow(&conn, &second_person_follow).unwrap();
|
CommunityFollower::follow(&conn, &second_person_follow).unwrap();
|
||||||
@ -82,7 +82,7 @@ mod tests {
|
|||||||
let another_community_follow = CommunityFollowerForm {
|
let another_community_follow = CommunityFollowerForm {
|
||||||
community_id: another_inserted_community.id,
|
community_id: another_inserted_community.id,
|
||||||
person_id: inserted_person.id,
|
person_id: inserted_person.id,
|
||||||
pending: Some(false),
|
pending: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
CommunityFollower::follow(&conn, &another_community_follow).unwrap();
|
CommunityFollower::follow(&conn, &another_community_follow).unwrap();
|
||||||
|
@ -380,7 +380,7 @@ mod tests {
|
|||||||
let community_follower_form = CommunityFollowerForm {
|
let community_follower_form = CommunityFollowerForm {
|
||||||
community_id: inserted_community.id,
|
community_id: inserted_community.id,
|
||||||
person_id: inserted_person.id,
|
person_id: inserted_person.id,
|
||||||
pending: Some(false),
|
pending: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
let inserted_community_follower =
|
let inserted_community_follower =
|
||||||
|
@ -137,5 +137,5 @@ pub struct CommunityFollower {
|
|||||||
pub struct CommunityFollowerForm {
|
pub struct CommunityFollowerForm {
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
pub person_id: PersonId,
|
pub person_id: PersonId,
|
||||||
pub pending: Option<bool>,
|
pub pending: bool,
|
||||||
}
|
}
|
||||||
|
@ -4,5 +4,5 @@ update community_follower set pending = true where pending is null;
|
|||||||
|
|
||||||
alter table community_follower
|
alter table community_follower
|
||||||
alter column pending set not null,
|
alter column pending set not null,
|
||||||
alter column pending set default true;
|
alter column pending drop default;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user