Skip to content
Snippets Groups Projects
Commit 9e225078 authored by insert's avatar insert
Browse files

Allow people with mutual connections to see profile / status; fix username check.

parent 2050a060
Branches
Tags
No related merge requests found
Pipeline #966 passed with stage
in 10 minutes and 52 seconds
...@@ -2475,7 +2475,7 @@ dependencies = [ ...@@ -2475,7 +2475,7 @@ dependencies = [
[[package]] [[package]]
name = "revolt" name = "revolt"
version = "0.4.0-alpha.5" version = "0.4.0-alpha.6"
dependencies = [ dependencies = [
"async-std", "async-std",
"async-tungstenite", "async-tungstenite",
......
[package] [package]
name = "revolt" name = "revolt"
version = "0.4.0-alpha.5" version = "0.4.0-alpha.6"
authors = ["Paul Makles <paulmakles@gmail.com>"] authors = ["Paul Makles <paulmakles@gmail.com>"]
edition = "2018" edition = "2018"
......
...@@ -110,7 +110,7 @@ impl User { ...@@ -110,7 +110,7 @@ impl User {
/// Utility function for checking claimed usernames. /// Utility function for checking claimed usernames.
pub async fn is_username_taken(username: &str) -> Result<bool> { pub async fn is_username_taken(username: &str) -> Result<bool> {
if username == "revolt" && username == "admin" { if username.to_lowercase() == "revolt" && username.to_lowercase() == "admin" {
return Ok(true); return Ok(true);
} }
......
...@@ -11,7 +11,7 @@ pub struct PermissionCalculator<'a> { ...@@ -11,7 +11,7 @@ pub struct PermissionCalculator<'a> {
user: Option<&'a User>, user: Option<&'a User>,
channel: Option<&'a Channel>, channel: Option<&'a Channel>,
has_mutual_conncetion: bool, has_mutual_connection: bool,
} }
impl<'a> PermissionCalculator<'a> { impl<'a> PermissionCalculator<'a> {
...@@ -22,7 +22,7 @@ impl<'a> PermissionCalculator<'a> { ...@@ -22,7 +22,7 @@ impl<'a> PermissionCalculator<'a> {
user: None, user: None,
channel: None, channel: None,
has_mutual_conncetion: false, has_mutual_connection: false,
} }
} }
...@@ -42,7 +42,7 @@ impl<'a> PermissionCalculator<'a> { ...@@ -42,7 +42,7 @@ impl<'a> PermissionCalculator<'a> {
pub fn with_mutual_connection(self) -> PermissionCalculator<'a> { pub fn with_mutual_connection(self) -> PermissionCalculator<'a> {
PermissionCalculator { PermissionCalculator {
has_mutual_conncetion: true, has_mutual_connection: true,
..self ..self
} }
} }
......
...@@ -64,7 +64,7 @@ impl<'a> PermissionCalculator<'a> { ...@@ -64,7 +64,7 @@ impl<'a> PermissionCalculator<'a> {
_ => {} _ => {}
} }
if self.has_mutual_conncetion if self.has_mutual_connection
|| get_collection("channels") || get_collection("channels")
.find_one( .find_one(
doc! { doc! {
...@@ -84,7 +84,8 @@ impl<'a> PermissionCalculator<'a> { ...@@ -84,7 +84,8 @@ impl<'a> PermissionCalculator<'a> {
})? })?
.is_some() .is_some()
{ {
return Ok(UserPermission::Access as u32); // ! FIXME: add privacy settings
return Ok(UserPermission::Access + UserPermission::ViewProfile);
} }
Ok(permissions) Ok(permissions)
......
...@@ -9,7 +9,7 @@ use rocket_contrib::json::JsonValue; ...@@ -9,7 +9,7 @@ use rocket_contrib::json::JsonValue;
#[get("/")] #[get("/")]
pub async fn root() -> JsonValue { pub async fn root() -> JsonValue {
json!({ json!({
"revolt": "0.4.0-alpha.5", "revolt": "0.4.0-alpha.6",
"features": { "features": {
"registration": !*DISABLE_REGISTRATION, "registration": !*DISABLE_REGISTRATION,
"captcha": { "captcha": {
......
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