forked from jmug/stoatchat
Run cargo fmt.
This commit is contained in:
@@ -31,10 +31,7 @@ pub async fn req(user: User, username: String) -> Result<JsonValue> {
|
||||
with: "user",
|
||||
})?;
|
||||
|
||||
match get_relationship(
|
||||
&user,
|
||||
&target_id,
|
||||
) {
|
||||
match get_relationship(&user, &target_id) {
|
||||
RelationshipStatus::User => return Err(Error::NoEffect),
|
||||
RelationshipStatus::Friend => return Err(Error::AlreadyFriends),
|
||||
RelationshipStatus::Outgoing => return Err(Error::AlreadySentRequest),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::{database::*, notifications::websocket::is_online};
|
||||
use crate::util::result::{Error, Result};
|
||||
use crate::{database::*, notifications::websocket::is_online};
|
||||
|
||||
use rocket_contrib::json::JsonValue;
|
||||
|
||||
|
||||
@@ -6,38 +6,24 @@ use crate::database::Ref;
|
||||
#[get("/<target>/avatar")]
|
||||
pub async fn req(target: Ref) -> Option<NamedFile> {
|
||||
match target.id.chars().nth(25).unwrap() {
|
||||
'0' |
|
||||
'1' |
|
||||
'2' |
|
||||
'3' |
|
||||
'4' |
|
||||
'5' |
|
||||
'6' |
|
||||
'7' => NamedFile::open(Path::new("assets/user_red.png")).await.ok(),
|
||||
'8' |
|
||||
'9' |
|
||||
'A' |
|
||||
'C' |
|
||||
'B' |
|
||||
'D' |
|
||||
'E' |
|
||||
'F' => NamedFile::open(Path::new("assets/user_green.png")).await.ok(),
|
||||
'G' |
|
||||
'H' |
|
||||
'J' |
|
||||
'K' |
|
||||
'M' |
|
||||
'N' |
|
||||
'P' |
|
||||
'Q' => NamedFile::open(Path::new("assets/user_blue.png")).await.ok(),
|
||||
'R' |
|
||||
'S' |
|
||||
'T' |
|
||||
'V' |
|
||||
'W' |
|
||||
'X' |
|
||||
'Y' |
|
||||
'Z' => NamedFile::open(Path::new("assets/user_yellow.png")).await.ok(),
|
||||
_ => unreachable!()
|
||||
'0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' => {
|
||||
NamedFile::open(Path::new("assets/user_red.png")).await.ok()
|
||||
}
|
||||
'8' | '9' | 'A' | 'C' | 'B' | 'D' | 'E' | 'F' => {
|
||||
NamedFile::open(Path::new("assets/user_green.png"))
|
||||
.await
|
||||
.ok()
|
||||
}
|
||||
'G' | 'H' | 'J' | 'K' | 'M' | 'N' | 'P' | 'Q' => {
|
||||
NamedFile::open(Path::new("assets/user_blue.png"))
|
||||
.await
|
||||
.ok()
|
||||
}
|
||||
'R' | 'S' | 'T' | 'V' | 'W' | 'X' | 'Y' | 'Z' => {
|
||||
NamedFile::open(Path::new("assets/user_yellow.png"))
|
||||
.await
|
||||
.ok()
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user