chore: Remove remove_in_chat_request trait function

Signed-off-by: Awiteb <a@4rs.nl>
This commit is contained in:
Awiteb 2024-07-29 14:01:27 +03:00
parent 476bffb37b
commit 1249d9c8bf
Signed by: awiteb
GPG key ID: 3F6B55640AA6682F
2 changed files with 0 additions and 30 deletions

View file

@ -32,12 +32,6 @@ pub trait IncomingChatExt {
chat_request_sender: &PublicKey, chat_request_sender: &PublicKey,
) -> ServerResult<()>; ) -> ServerResult<()>;
/// Remove incoming chat request
async fn remove_in_chat_request(
&self,
chat_request_recipient: &UserModel,
chat_request_sender: &PublicKey,
) -> ServerResult<()>;
} }
impl IncomingChatExt for DatabaseConnection { impl IncomingChatExt for DatabaseConnection {
@ -67,24 +61,3 @@ impl IncomingChatExt for DatabaseConnection {
Ok(()) Ok(())
} }
async fn remove_in_chat_request(
&self,
chat_request_recipient: &UserModel,
chat_request_sender: &PublicKey,
) -> ServerResult<()> {
if let Some(user) = chat_request_recipient
.find_related(IncomingChatEntity)
.filter(
IncomingChatColumn::Sender
.eq(chat_request_sender)
.and(IncomingChatColumn::AcceptedResponse.eq(Option::<bool>::None)),
)
.one(self)
.await?
.map(IntoActiveModel::into_active_model)
{
user.delete(self).await?;
}
Ok(())
}
}

View file

@ -132,9 +132,6 @@ pub async fn handle_chat_response(
db.remove_out_chat_request(&response_recipient, &response_sender.public_key) db.remove_out_chat_request(&response_recipient, &response_sender.public_key)
.await .await
); );
try_ws!(Some
db.remove_in_chat_request(response_sender, &response_recipient.public_key).await
);
if let Some(conn_id) = ONLINE_USERS.is_online(&response_recipient.public_key).await { if let Some(conn_id) = ONLINE_USERS.is_online(&response_recipient.public_key).await {
ONLINE_USERS ONLINE_USERS