change: Rename OutChatRequestsExt::have_chat_request_to function to get_chat_request_to
All checks were successful
DCO checker / DCO checker (pull_request) Successful in 3s
Rust CI / Rust CI (pull_request) Successful in 4m11s

Signed-off-by: Awiteb <a@4rs.nl>
This commit is contained in:
Awiteb 2024-07-18 11:22:56 +03:00
parent 21880c5f82
commit 39e7861917
Signed by: awiteb
GPG key ID: 3F6B55640AA6682F
2 changed files with 5 additions and 5 deletions

View file

@ -27,7 +27,7 @@ use crate::{errors::ServerResult, websocket::errors::WsError};
pub trait OutChatRequestsExt { pub trait OutChatRequestsExt {
/// Returns the outgoing chat request if the `user` have a sent chat request /// Returns the outgoing chat request if the `user` have a sent chat request
/// to the `recipient` /// to the `recipient`
async fn have_chat_request_to( async fn get_chat_request_to(
&self, &self,
requester: &UserModel, requester: &UserModel,
recipient: &PublicKey, recipient: &PublicKey,
@ -50,7 +50,7 @@ pub trait OutChatRequestsExt {
impl OutChatRequestsExt for DatabaseConnection { impl OutChatRequestsExt for DatabaseConnection {
#[logcall::logcall] #[logcall::logcall]
async fn have_chat_request_to( async fn get_chat_request_to(
&self, &self,
requester: &UserModel, requester: &UserModel,
recipient: &PublicKey, recipient: &PublicKey,
@ -94,7 +94,7 @@ impl OutChatRequestsExt for DatabaseConnection {
requester: &UserModel, requester: &UserModel,
recipient: &PublicKey, recipient: &PublicKey,
) -> ServerResult<()> { ) -> ServerResult<()> {
if let Some(out_model) = self.have_chat_request_to(requester, recipient).await? { if let Some(out_model) = self.get_chat_request_to(requester, recipient).await? {
out_model.delete(self).await?; out_model.delete(self).await?;
} }
Ok(()) Ok(())

View file

@ -49,7 +49,7 @@ pub async fn handle_chat_request(
// FIXME: When change the entity public key to a PublicKey type, change this // FIXME: When change the entity public key to a PublicKey type, change this
let from_public_key = PublicKey::from_str(&from_user.public_key).expect("Is valid public key"); let from_public_key = PublicKey::from_str(&from_user.public_key).expect("Is valid public key");
if try_ws!(Some db.have_chat_request_to(from_user, to_public_key).await).is_some() { if try_ws!(Some db.get_chat_request_to(from_user, to_public_key).await).is_some() {
return Some(WsError::AlreadySendChatRequest.into()); return Some(WsError::AlreadySendChatRequest.into());
} }
@ -99,7 +99,7 @@ pub async fn handle_chat_response(
PublicKey::from_str(&recipient_user.public_key).expect("Is valid public key"); PublicKey::from_str(&recipient_user.public_key).expect("Is valid public key");
if try_ws!(Some if try_ws!(Some
db.have_chat_request_to(&sender_user, &recipient_public_key) db.get_chat_request_to(&sender_user, &recipient_public_key)
.await .await
) )
.is_none() .is_none()