chore: make amqp required

Signed-off-by: Zomatree <me@zomatree.live>
This commit is contained in:
Zomatree
2026-08-03 04:56:22 +01:00
parent 1654f8a276
commit 7cf833948e
4 changed files with 7 additions and 10 deletions

View File

@@ -542,7 +542,7 @@ impl User {
pub async fn add_friend(
&mut self,
db: &Database,
amqp: Option<&AMQP>,
amqp: &AMQP,
target: &mut User,
) -> Result<()> {
match self.relationship_with(&target.id) {
@@ -552,10 +552,8 @@ impl User {
RelationshipStatus::Blocked => Err(create_error!(Blocked)),
RelationshipStatus::BlockedOther => Err(create_error!(BlockedByOther)),
RelationshipStatus::Incoming => {
if let Some(amqp) = amqp {
// Accept incoming friend request
_ = amqp.friend_request_accepted(self, target).await;
};
// Accept incoming friend request
_ = amqp.friend_request_accepted(self, target).await;
self.apply_relationship(
db,
@@ -585,9 +583,7 @@ impl User {
}));
}
if let Some(amqp) = amqp {
_ = amqp.friend_request_received(target, self).await;
};
_ = amqp.friend_request_received(target, self).await;
// Send the friend request
self.apply_relationship(

View File

@@ -255,6 +255,7 @@ pub async fn ingress(
message
.update(
db,
Some(amqp),
PartialMessage {
system: message.system.clone(),
..Default::default()

View File

@@ -22,6 +22,6 @@ pub async fn add(
return Err(create_error!(IsBot));
}
user.add_friend(db, Some(amqp), &mut target).await?;
user.add_friend(db, amqp, &mut target).await?;
Ok(Json(target.into(db, &user).await))
}

View File

@@ -23,7 +23,7 @@ pub async fn send_friend_request(
return Err(create_error!(IsBot));
}
user.add_friend(db, Some(amqp), &mut target).await?;
user.add_friend(db, amqp, &mut target).await?;
Ok(Json(target.into(db, &user).await))
} else {
Err(create_error!(InvalidProperty))