refactor: Refactor in_chat_requests
table #35
2 changed files with 0 additions and 30 deletions
|
@ -32,12 +32,6 @@ pub trait IncomingChatExt {
|
|||
chat_request_sender: &PublicKey,
|
||||
) -> 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 {
|
||||
|
@ -67,24 +61,3 @@ impl IncomingChatExt for DatabaseConnection {
|
|||
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(())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -132,9 +132,6 @@ pub async fn handle_chat_response(
|
|||
db.remove_out_chat_request(&response_recipient, &response_sender.public_key)
|
||||
.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 {
|
||||
ONLINE_USERS
|
||||
|
|
Loading…
Reference in a new issue