Simpler activitypub vote check.

This commit is contained in:
Dessalines 2024-09-30 20:32:09 -04:00
parent f583041d5f
commit c4e0c24408

View File

@ -79,10 +79,8 @@ impl ActivityHandler for Vote {
}; };
// Don't allow dislikes for either disabled, or local only votes // Don't allow dislikes for either disabled, or local only votes
let downvote_fail = self.kind == VoteType::Dislike let downvote_fail = self.kind == VoteType::Dislike && downvote_setting != FederationMode::All;
&& [FederationMode::Disable, FederationMode::Local].contains(&downvote_setting); let upvote_fail = self.kind == VoteType::Like && upvote_setting != FederationMode::All;
let upvote_fail = self.kind == VoteType::Like
&& [FederationMode::Disable, FederationMode::Local].contains(&upvote_setting);
if downvote_fail || upvote_fail { if downvote_fail || upvote_fail {
// If this is a rejection, undo the vote // If this is a rejection, undo the vote