From 21a97cdd0b08ccf999cbb58326f57f6ac82a7a85 Mon Sep 17 00:00:00 2001 From: nexy7574 Date: Fri, 20 Feb 2026 21:31:45 +0000 Subject: [PATCH] chore: Refactor existing references to transaction service --- src/api/client/send.rs | 4 ++-- src/api/client/to_device.rs | 4 ++-- src/api/server/send.rs | 4 ++-- src/service/transaction_ids/mod.rs | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/api/client/send.rs b/src/api/client/send.rs index c6ceeeff..2c082a3e 100644 --- a/src/api/client/send.rs +++ b/src/api/client/send.rs @@ -51,7 +51,7 @@ pub(crate) async fn send_message_event_route( // Check if this is a new transaction id if let Ok(response) = services .transaction_ids - .existing_txnid(sender_user, sender_device, &body.txn_id) + .get_client_txn(sender_user, sender_device, &body.txn_id) .await { // The client might have sent a txnid of the /sendToDevice endpoint @@ -92,7 +92,7 @@ pub(crate) async fn send_message_event_route( ) .await?; - services.transaction_ids.add_txnid( + services.transaction_ids.add_client_txnid( sender_user, sender_device, &body.txn_id, diff --git a/src/api/client/to_device.rs b/src/api/client/to_device.rs index 581f4a72..abed0ac3 100644 --- a/src/api/client/to_device.rs +++ b/src/api/client/to_device.rs @@ -27,7 +27,7 @@ pub(crate) async fn send_event_to_device_route( // Check if this is a new transaction id if services .transaction_ids - .existing_txnid(sender_user, sender_device, &body.txn_id) + .get_client_txn(sender_user, sender_device, &body.txn_id) .await .is_ok() { @@ -105,7 +105,7 @@ pub(crate) async fn send_event_to_device_route( // Save transaction id with empty data services .transaction_ids - .add_txnid(sender_user, sender_device, &body.txn_id, &[]); + .add_client_txnid(sender_user, sender_device, &body.txn_id, &[]); Ok(send_event_to_device::v3::Response {}) } diff --git a/src/api/server/send.rs b/src/api/server/send.rs index 58a8c82b..ccdd074f 100644 --- a/src/api/server/send.rs +++ b/src/api/server/send.rs @@ -479,7 +479,7 @@ async fn handle_edu_direct_to_device( // Check if this is a new transaction id if services .transaction_ids - .existing_txnid(sender, None, message_id) + .get_client_txn(sender, None, message_id) .await .is_ok() { @@ -499,7 +499,7 @@ async fn handle_edu_direct_to_device( // Save transaction id with empty data services .transaction_ids - .add_txnid(sender, None, message_id, &[]); + .add_client_txnid(sender, None, message_id, &[]); } async fn handle_edu_direct_to_device_user( diff --git a/src/service/transaction_ids/mod.rs b/src/service/transaction_ids/mod.rs index 40bf44c3..9707dbb9 100644 --- a/src/service/transaction_ids/mod.rs +++ b/src/service/transaction_ids/mod.rs @@ -38,7 +38,7 @@ impl crate::Service for Service { } impl Service { - pub fn add_txnid( + pub fn add_client_txnid( &self, user_id: &UserId, device_id: Option<&DeviceId>, @@ -54,7 +54,7 @@ impl Service { self.db.userdevicetxnid_response.insert(&key, data); } - pub async fn existing_txnid( + pub async fn get_client_txn( &self, user_id: &UserId, device_id: Option<&DeviceId>,