diff --git a/crates/apub/src/activities/voting/mod.rs b/crates/apub/src/activities/voting/mod.rs index 6ecf37c8f..0649b527c 100644 --- a/crates/apub/src/activities/voting/mod.rs +++ b/crates/apub/src/activities/voting/mod.rs @@ -132,8 +132,8 @@ pub async fn check_vote_permission( ) -> LemmyResult<()> { let local_site = LocalSite::read(&mut context.pool()).await?; let community = Community::read(&mut context.pool(), community_id).await?; - let score = vote_type.map(|v| v.into()).unwrap_or(0); - lemmy_api_common::utils::check_vote_permission(score, &local_site, &person, &community, &context) + let score = vote_type.map(std::convert::Into::into).unwrap_or(0); + lemmy_api_common::utils::check_vote_permission(score, &local_site, person, &community, context) .await?; Ok(()) } diff --git a/crates/db_schema/src/impls/community.rs b/crates/db_schema/src/impls/community.rs index 18f3c41cc..9384a598e 100644 --- a/crates/db_schema/src/impls/community.rs +++ b/crates/db_schema/src/impls/community.rs @@ -434,6 +434,7 @@ mod tests { hidden: false, posting_restricted_to_mods: false, instance_id: inserted_instance.id, + only_followers_can_vote: false, }; let community_follower_form = CommunityFollowerForm { diff --git a/crates/db_views/src/comment_report_view.rs b/crates/db_views/src/comment_report_view.rs index 83ab5c063..f4c2a78e3 100644 --- a/crates/db_views/src/comment_report_view.rs +++ b/crates/db_views/src/comment_report_view.rs @@ -379,6 +379,7 @@ mod tests { moderators_url: inserted_community.moderators_url, featured_url: inserted_community.featured_url, instance_id: inserted_instance.id, + only_followers_can_vote: inserted_community.only_followers_can_vote, }, creator: Person { id: inserted_jessica.id, diff --git a/crates/db_views/src/comment_view.rs b/crates/db_views/src/comment_view.rs index 62f6634c1..e7b8ecc0b 100644 --- a/crates/db_views/src/comment_view.rs +++ b/crates/db_views/src/comment_view.rs @@ -1041,6 +1041,7 @@ mod tests { shared_inbox_url: data.inserted_community.shared_inbox_url.clone(), moderators_url: data.inserted_community.moderators_url.clone(), featured_url: data.inserted_community.featured_url.clone(), + only_followers_can_vote: data.inserted_community.only_followers_can_vote, }, counts: CommentAggregates { comment_id: data.inserted_comment_0.id, diff --git a/crates/db_views/src/post_view.rs b/crates/db_views/src/post_view.rs index c0f9c6e46..12e5f8603 100644 --- a/crates/db_views/src/post_view.rs +++ b/crates/db_views/src/post_view.rs @@ -1539,6 +1539,7 @@ mod tests { shared_inbox_url: inserted_community.shared_inbox_url.clone(), moderators_url: inserted_community.moderators_url.clone(), featured_url: inserted_community.featured_url.clone(), + only_followers_can_vote: inserted_community.only_followers_can_vote, }, counts: PostAggregates { post_id: inserted_post.id, diff --git a/migrations/2024-01-22-105746_lemmynsfw-changes/down.sql b/migrations/2024-01-22-105746_lemmynsfw-changes/down.sql index 8bda0ffde..df1342a03 100644 --- a/migrations/2024-01-22-105746_lemmynsfw-changes/down.sql +++ b/migrations/2024-01-22-105746_lemmynsfw-changes/down.sql @@ -1,2 +1,6 @@ -alter table local_site drop column content_warning; -alter table community drop column only_followers_can_vote; +ALTER TABLE local_site + DROP COLUMN content_warning; + +ALTER TABLE community + DROP COLUMN only_followers_can_vote; + diff --git a/migrations/2024-01-22-105746_lemmynsfw-changes/up.sql b/migrations/2024-01-22-105746_lemmynsfw-changes/up.sql index 9c117a454..f77e7e802 100644 --- a/migrations/2024-01-22-105746_lemmynsfw-changes/up.sql +++ b/migrations/2024-01-22-105746_lemmynsfw-changes/up.sql @@ -1,2 +1,6 @@ -alter table local_site add column content_warning text; -alter table community add column only_followers_can_vote boolean not null default false; \ No newline at end of file +ALTER TABLE local_site + ADD COLUMN content_warning text; + +ALTER TABLE community + ADD COLUMN only_followers_can_vote boolean NOT NULL DEFAULT FALSE; +