refactor: Refactor in_chat_requests table #35

Manually merged
awiteb merged 7 commits from awiteb/rename-chat-request-table-and-save-respnse-in-it into master 2024-07-30 10:39:04 +02:00 AGit
2 changed files with 0 additions and 30 deletions
Showing only changes of commit 1249d9c8bf - Show all commits

View file

@ -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(())
}
}

View file

@ -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