-fn get_feed_inbox(conn: &PgConnection, jwt: String) -> Result<ChannelBuilder, LemmyError> {
- let site_view = SiteView::read(&conn)?;
- let user_id = Claims::decode(&jwt)?.claims.id;
-
- let sort = SortType::New;
-
- let replies = CommentQueryBuilder::create(&conn)
- .recipient_id(user_id)
- .my_user_id(user_id)
- .sort(&sort)
- .list()?;
-
- let mentions = UserMentionQueryBuilder::create(&conn)
- .recipient_id(user_id)
- .my_user_id(user_id)
- .sort(&sort)
- .list()?;
+#[tracing::instrument(skip_all)]
+async fn get_feed_inbox(
+ pool: &mut DbPool<'_>,
+ jwt_secret: &str,
+ jwt: &str,
+ protocol_and_hostname: &str,
+) -> Result<ChannelBuilder, LemmyError> {
+ let site_view = SiteView::read_local(pool).await?;
+ let local_user_id = LocalUserId(Claims::decode(jwt, jwt_secret)?.claims.sub);
+ let local_user = LocalUser::read(pool, local_user_id).await?;
+ let person_id = local_user.person_id;
+ let show_bot_accounts = local_user.show_bot_accounts;
+
+ let sort = CommentSortType::New;
+
+ let replies = CommentReplyQuery {
+ recipient_id: (Some(person_id)),
+ my_person_id: (Some(person_id)),
+ show_bot_accounts: (show_bot_accounts),
+ sort: (Some(sort)),
+ limit: (Some(RSS_FETCH_LIMIT)),
+ ..Default::default()
+ }
+ .list(pool)
+ .await?;
+
+ let mentions = PersonMentionQuery {
+ recipient_id: (Some(person_id)),
+ my_person_id: (Some(person_id)),
+ show_bot_accounts: (show_bot_accounts),
+ sort: (Some(sort)),
+ limit: (Some(RSS_FETCH_LIMIT)),
+ ..Default::default()
+ }
+ .list(pool)
+ .await?;