Breaking: Provide new user object instead of id.

Fix rustup complaining about join macros.
This commit is contained in:
Paul
2021-05-01 15:54:29 +01:00
parent c8981ac695
commit 5da26cb833
12 changed files with 90 additions and 31 deletions

View File

@@ -10,6 +10,8 @@ use rocket_contrib::json::JsonValue;
pub async fn req(user: User, target: Ref) -> Result<JsonValue> {
let col = get_collection("users");
let target = target.fetch_user().await?;
match get_relationship(&user, &target.id) {
RelationshipStatus::Friend
| RelationshipStatus::Outgoing
@@ -43,19 +45,23 @@ pub async fn req(user: User, target: Ref) -> Result<JsonValue> {
)
) {
Ok(_) => {
let target = target.from_override(&user, RelationshipStatus::None).await?;
let user = user.from_override(&target, RelationshipStatus::None).await?;
let target_id = target.id.clone();
try_join!(
ClientboundNotification::UserRelationship {
id: user.id.clone(),
user: target.id.clone(),
user: target,
status: RelationshipStatus::None
}
.publish(user.id.clone()),
ClientboundNotification::UserRelationship {
id: target.id.clone(),
user: user.id.clone(),
id: target_id.clone(),
user,
status: RelationshipStatus::None
}
.publish(target.id.clone())
.publish(target_id)
)
.ok();