diff --git a/changelog.d/1726.bugfix.md b/changelog.d/1726.bugfix.md new file mode 100644 index 000000000..dee6a9e1d --- /dev/null +++ b/changelog.d/1726.bugfix.md @@ -0,0 +1 @@ +Fixed `!admin query pusher delete-all-user` reporting success without deleting any pushers. Contributed by @eleboucher. diff --git a/src/admin/query/pusher.rs b/src/admin/query/pusher.rs index e3c2cfa8f..1f10a2e4c 100644 --- a/src/admin/query/pusher.rs +++ b/src/admin/query/pusher.rs @@ -59,7 +59,7 @@ pub(super) async fn process(subcommand: PusherCommand, context: &Context<'_>) -> pushers .stream() .for_each(async |pushkey| { - services.pusher.delete_pusher(&user_id, pushkey).await; + services.pusher.delete_pusher(&user_id, &pushkey).await; }) .await; write!(context, "Deleted {pusher_count} pushers for {user_id}.") @@ -68,7 +68,6 @@ pub(super) async fn process(subcommand: PusherCommand, context: &Context<'_>) -> let pushers = services .pusher .get_pushkeys(&user_id) - .map(ToOwned::to_owned) .broad_filter_map(async |pushkey| { services .pusher diff --git a/src/api/client/account/mod.rs b/src/api/client/account/mod.rs index bd2d94110..a5d91a9f8 100644 --- a/src/api/client/account/mod.rs +++ b/src/api/client/account/mod.rs @@ -145,7 +145,6 @@ pub(crate) async fn change_password_route( services .pusher .get_pushkeys(&sender_user) - .map(ToOwned::to_owned) .broad_filter_map(async |pushkey| { services .pusher @@ -339,7 +338,7 @@ pub async fn full_user_deactivate( .pusher .get_pushkeys(user_id) .for_each(async |pushkey| { - services.pusher.delete_pusher(user_id, pushkey).await; + services.pusher.delete_pusher(user_id, &pushkey).await; }) .await; diff --git a/src/api/client/session.rs b/src/api/client/session.rs index c88bcea21..f68c6dd7b 100644 --- a/src/api/client/session.rs +++ b/src/api/client/session.rs @@ -298,7 +298,6 @@ pub(crate) async fn logout_route( services .pusher .get_pushkeys(sender_user) - .map(ToOwned::to_owned) .broad_filter_map(async |pushkey| { services .pusher @@ -345,7 +344,7 @@ pub(crate) async fn logout_all_route( .pusher .get_pushkeys(sender_user) .for_each(async |pushkey| { - services.pusher.delete_pusher(sender_user, pushkey).await; + services.pusher.delete_pusher(sender_user, &pushkey).await; }) .await; diff --git a/src/service/pusher/mod.rs b/src/service/pusher/mod.rs index 437006d00..3a15fd6bc 100644 --- a/src/service/pusher/mod.rs +++ b/src/service/pusher/mod.rs @@ -182,13 +182,14 @@ pub async fn get_pushers(&self, sender: &UserId) -> Vec { pub fn get_pushkeys<'a>( &'a self, sender: &'a UserId, - ) -> impl Stream + Send + 'a { + ) -> impl Stream + Send + 'a { let prefix = (sender, Interfix); self.db .senderkey_pusher .keys_prefix(&prefix) .ignore_err() .map(|(_, pushkey): (Ignore, &str)| pushkey) + .map(ToOwned::to_owned) } #[tracing::instrument(skip(self, dest, request))] diff --git a/src/service/rooms/timeline/append.rs b/src/service/rooms/timeline/append.rs index e56674c2f..0dab36347 100644 --- a/src/service/rooms/timeline/append.rs +++ b/src/service/rooms/timeline/append.rs @@ -540,7 +540,7 @@ async fn notify_local_users(&self, pdu: &PduEvent, pdu_id: &RawPduId, room_id: & .ready_for_each(|push_key| { self.services .sending - .send_pdu_push(pdu_id, user, push_key.to_owned()) + .send_pdu_push(pdu_id, user, push_key) .expect("TODO: replace with future"); }) .await;