- #[tracing::instrument(skip(self, context, _websocket_id))]
- async fn perform(
- &self,
- context: &Data<LemmyContext>,
- _websocket_id: Option<ConnectionId>,
- ) -> Result<PrivateMessagesResponse, LemmyError> {
- let data: &GetPrivateMessages = self;
- let local_user_view =
- get_local_user_view_from_jwt(data.auth.as_ref(), context.pool(), context.secret()).await?;
- let person_id = local_user_view.person.id;
-
- let page = data.page;
- let limit = data.limit;
- let unread_only = data.unread_only;
- let mut messages = blocking(context.pool(), move |conn| {
- PrivateMessageQuery::builder()
- .conn(conn)
- .recipient_id(person_id)
- .page(page)
- .limit(limit)
- .unread_only(unread_only)
- .build()
- .list()
- })
- .await??;
+ let page = data.page;
+ let limit = data.limit;
+ let unread_only = data.unread_only.unwrap_or_default();
+ let creator_id = data.creator_id;
+ let mut messages = PrivateMessageQuery {
+ page,
+ limit,
+ unread_only,
+ creator_id,
+ }
+ .list(&mut context.pool(), person_id)
+ .await?;