forked from jmug/stoatchat
Allow people with mutual connections to see profile / status; fix username check.
This commit is contained in:
@@ -11,7 +11,7 @@ pub struct PermissionCalculator<'a> {
|
||||
user: Option<&'a User>,
|
||||
channel: Option<&'a Channel>,
|
||||
|
||||
has_mutual_conncetion: bool,
|
||||
has_mutual_connection: bool,
|
||||
}
|
||||
|
||||
impl<'a> PermissionCalculator<'a> {
|
||||
@@ -22,7 +22,7 @@ impl<'a> PermissionCalculator<'a> {
|
||||
user: None,
|
||||
channel: None,
|
||||
|
||||
has_mutual_conncetion: false,
|
||||
has_mutual_connection: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ impl<'a> PermissionCalculator<'a> {
|
||||
|
||||
pub fn with_mutual_connection(self) -> PermissionCalculator<'a> {
|
||||
PermissionCalculator {
|
||||
has_mutual_conncetion: true,
|
||||
has_mutual_connection: true,
|
||||
..self
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ impl<'a> PermissionCalculator<'a> {
|
||||
_ => {}
|
||||
}
|
||||
|
||||
if self.has_mutual_conncetion
|
||||
if self.has_mutual_connection
|
||||
|| get_collection("channels")
|
||||
.find_one(
|
||||
doc! {
|
||||
@@ -84,7 +84,8 @@ impl<'a> PermissionCalculator<'a> {
|
||||
})?
|
||||
.is_some()
|
||||
{
|
||||
return Ok(UserPermission::Access as u32);
|
||||
// ! FIXME: add privacy settings
|
||||
return Ok(UserPermission::Access + UserPermission::ViewProfile);
|
||||
}
|
||||
|
||||
Ok(permissions)
|
||||
|
||||
Reference in New Issue
Block a user