mirror of
https://forgejo.ellis.link/continuwuation/continuwuity/
synced 2026-10-06 22:27:37 +00:00
style: Don't return Allow in an else block
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum FilterLevel {
|
||||
Allow,
|
||||
ExplicitAllow,
|
||||
Ignore,
|
||||
Block,
|
||||
}
|
||||
@@ -124,7 +125,7 @@ pub fn user_filter_level(&self, user: &UserId) -> FilterLevel {
|
||||
} else if !self.enabled {
|
||||
FilterLevel::Allow
|
||||
} else if Self::matches(&self.allowed_users, user.as_str()) {
|
||||
FilterLevel::Allow
|
||||
FilterLevel::ExplicitAllow
|
||||
} else if Self::matches(&self.ignored_users, user.as_str()) {
|
||||
FilterLevel::Ignore
|
||||
} else if Self::matches(&self.blocked_users, user.as_str()) {
|
||||
@@ -144,7 +145,7 @@ pub fn server_filter_level(&self, server: &ServerName) -> FilterLevel {
|
||||
} else {
|
||||
let server = server.host();
|
||||
if Self::matches(&self.allowed_servers, server) {
|
||||
FilterLevel::Allow
|
||||
FilterLevel::ExplicitAllow
|
||||
} else if Self::matches(&self.ignored_servers, server) {
|
||||
FilterLevel::Ignore
|
||||
} else if Self::matches(&self.blocked_servers, server) {
|
||||
|
||||
@@ -119,14 +119,14 @@ pub async fn invite_filter_level(
|
||||
.check_msc4494_mutual_room(sender_user, recipient_user)
|
||||
.await
|
||||
{
|
||||
FilterLevel::Block
|
||||
} else {
|
||||
FilterLevel::Allow
|
||||
return FilterLevel::Block;
|
||||
}
|
||||
|
||||
FilterLevel::Allow
|
||||
}
|
||||
}
|
||||
|
||||
/// Checks that sender and recipient share at least one rule that has a join
|
||||
/// Checks that sender and recipient share at least one room that has a join
|
||||
/// rule other than `public`.
|
||||
async fn check_msc4494_mutual_room(&self, sender: &UserId, recipient: &UserId) -> bool {
|
||||
let mut mutual_rooms = std::pin::pin!(
|
||||
|
||||
Reference in New Issue
Block a user