This commit is contained in:
Felix Ableitner 2024-01-23 11:58:04 +01:00
parent d8aa6b3350
commit d9fc981b06
7 changed files with 18 additions and 6 deletions

View file

@ -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(())
}

View file

@ -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 {

View file

@ -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,

View file

@ -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,

View file

@ -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,

View file

@ -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;

View file

@ -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;
ALTER TABLE local_site
ADD COLUMN content_warning text;
ALTER TABLE community
ADD COLUMN only_followers_can_vote boolean NOT NULL DEFAULT FALSE;