Skip to content
Snippets Groups Projects
Verified Commit 2851fbca authored by insert's avatar insert
Browse files

Handle self DM permissions correctly.

parent d6c7b746
No related merge requests found
...@@ -168,19 +168,23 @@ impl PermissionCalculator { ...@@ -168,19 +168,23 @@ impl PermissionCalculator {
} }
} }
// ? In this case, it is a "self DM".
if other_user == "" {
return 1024 + 128 + 32 + 16 + 1;
}
let relationships = self.user.fetch_relationships(); let relationships = self.user.fetch_relationships();
let relationship = let relationship =
get_relationship_internal(&self.user.id, &other_user, &relationships); get_relationship_internal(&self.user.id, &other_user, &relationships);
if relationship == Relationship::SELF || if relationship == Relationship::Friend {
relationship == Relationship::Friend { permissions = 1024 + 128 + 32 + 16 + 1;
permissions = 177;
} else if relationship == Relationship::Blocked } else if relationship == Relationship::Blocked
|| relationship == Relationship::BlockedOther || relationship == Relationship::BlockedOther
{ {
permissions = 1; permissions = 1;
} else if has_mutual_connection(&self.user.id, other_user, true) { } else if has_mutual_connection(&self.user.id, other_user, true) {
permissions = 177; permissions = 1024 + 128 + 32 + 16 + 1;
} else { } else {
permissions = 1; permissions = 1;
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment