mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-16 05:36:50 +00:00
Introduce OptionFuture helpers
Optimize user directory searches
This commit is contained in:
1 parent
95121ad905
commit
e78bf21085
28 files changed
+454
-567
No files matched your search
@@ -1,9 +1,6 @@
|
||||
use std::{collections::HashSet, sync::Arc};
|
||||
|
||||
use futures::{
|
||||
FutureExt, StreamExt,
|
||||
future::{OptionFuture, join},
|
||||
};
|
||||
use futures::{FutureExt, StreamExt, future::join};
|
||||
use ruma::{
|
||||
RoomId, UserId,
|
||||
api::client::push::ProfileTag,
|
||||
@@ -111,13 +108,11 @@ pub(crate) async fn append_pdu(&self, pdu_id: RawPduId, pdu: &Pdu) -> Result {
|
||||
.iter()
|
||||
.any(|action| matches!(action, Action::SetTweak(Tweak::Highlight(true))));
|
||||
|
||||
let increment_notify: OptionFuture<_> = notify
|
||||
.then(|| self.increment_notificationcount(pdu.room_id(), user))
|
||||
.into();
|
||||
let increment_notify =
|
||||
notify.then_async(|| self.increment_notificationcount(pdu.room_id(), user));
|
||||
|
||||
let increment_highlight: OptionFuture<_> = highlight
|
||||
.then(|| self.increment_highlightcount(pdu.room_id(), user))
|
||||
.into();
|
||||
let increment_highlight =
|
||||
highlight.then_async(|| self.increment_highlightcount(pdu.room_id(), user));
|
||||
|
||||
join(increment_notify, increment_highlight).await;
|
||||
|
||||
|
||||
Reference in new issue
Block a user