chore: Refactor existing references to transaction service

This commit is contained in:
nexy7574
2026-02-23 16:36:44 +00:00
committed by timedout
parent e986cd4536
commit 21a97cdd0b
4 changed files with 8 additions and 8 deletions
+2 -2
View File
@@ -51,7 +51,7 @@ pub(crate) async fn send_message_event_route(
// Check if this is a new transaction id // Check if this is a new transaction id
if let Ok(response) = services if let Ok(response) = services
.transaction_ids .transaction_ids
.existing_txnid(sender_user, sender_device, &body.txn_id) .get_client_txn(sender_user, sender_device, &body.txn_id)
.await .await
{ {
// The client might have sent a txnid of the /sendToDevice endpoint // The client might have sent a txnid of the /sendToDevice endpoint
@@ -92,7 +92,7 @@ pub(crate) async fn send_message_event_route(
) )
.await?; .await?;
services.transaction_ids.add_txnid( services.transaction_ids.add_client_txnid(
sender_user, sender_user,
sender_device, sender_device,
&body.txn_id, &body.txn_id,
+2 -2
View File
@@ -27,7 +27,7 @@ pub(crate) async fn send_event_to_device_route(
// Check if this is a new transaction id // Check if this is a new transaction id
if services if services
.transaction_ids .transaction_ids
.existing_txnid(sender_user, sender_device, &body.txn_id) .get_client_txn(sender_user, sender_device, &body.txn_id)
.await .await
.is_ok() .is_ok()
{ {
@@ -105,7 +105,7 @@ pub(crate) async fn send_event_to_device_route(
// Save transaction id with empty data // Save transaction id with empty data
services services
.transaction_ids .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 {}) Ok(send_event_to_device::v3::Response {})
} }
+2 -2
View File
@@ -479,7 +479,7 @@ async fn handle_edu_direct_to_device(
// Check if this is a new transaction id // Check if this is a new transaction id
if services if services
.transaction_ids .transaction_ids
.existing_txnid(sender, None, message_id) .get_client_txn(sender, None, message_id)
.await .await
.is_ok() .is_ok()
{ {
@@ -499,7 +499,7 @@ async fn handle_edu_direct_to_device(
// Save transaction id with empty data // Save transaction id with empty data
services services
.transaction_ids .transaction_ids
.add_txnid(sender, None, message_id, &[]); .add_client_txnid(sender, None, message_id, &[]);
} }
async fn handle_edu_direct_to_device_user<Event: Send + Sync>( async fn handle_edu_direct_to_device_user<Event: Send + Sync>(
+2 -2
View File
@@ -38,7 +38,7 @@ impl crate::Service for Service {
} }
impl Service { impl Service {
pub fn add_txnid( pub fn add_client_txnid(
&self, &self,
user_id: &UserId, user_id: &UserId,
device_id: Option<&DeviceId>, device_id: Option<&DeviceId>,
@@ -54,7 +54,7 @@ impl Service {
self.db.userdevicetxnid_response.insert(&key, data); self.db.userdevicetxnid_response.insert(&key, data);
} }
pub async fn existing_txnid( pub async fn get_client_txn(
&self, &self,
user_id: &UserId, user_id: &UserId,
device_id: Option<&DeviceId>, device_id: Option<&DeviceId>,