mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-22 06:36:14 +00:00
parent
92d17639cd
commit
40609549d8
|
@ -33,6 +33,8 @@ use serde::Deserialize;
|
||||||
use std::{collections::BTreeMap, str::FromStr};
|
use std::{collections::BTreeMap, str::FromStr};
|
||||||
use strum::ParseError;
|
use strum::ParseError;
|
||||||
|
|
||||||
|
const RSS_FETCH_LIMIT: i64 = 20;
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
struct Params {
|
struct Params {
|
||||||
sort: Option<String>,
|
sort: Option<String>,
|
||||||
|
@ -91,6 +93,7 @@ async fn get_feed_data(
|
||||||
PostQueryBuilder::create(conn)
|
PostQueryBuilder::create(conn)
|
||||||
.listing_type(listing_type)
|
.listing_type(listing_type)
|
||||||
.sort(sort_type)
|
.sort(sort_type)
|
||||||
|
.limit(RSS_FETCH_LIMIT)
|
||||||
.list()
|
.list()
|
||||||
})
|
})
|
||||||
.await??;
|
.await??;
|
||||||
|
@ -184,6 +187,7 @@ fn get_feed_user(
|
||||||
.listing_type(ListingType::All)
|
.listing_type(ListingType::All)
|
||||||
.sort(*sort_type)
|
.sort(*sort_type)
|
||||||
.creator_id(person.id)
|
.creator_id(person.id)
|
||||||
|
.limit(RSS_FETCH_LIMIT)
|
||||||
.list()?;
|
.list()?;
|
||||||
|
|
||||||
let items = create_post_items(posts, protocol_and_hostname)?;
|
let items = create_post_items(posts, protocol_and_hostname)?;
|
||||||
|
@ -212,6 +216,7 @@ fn get_feed_community(
|
||||||
.listing_type(ListingType::Community)
|
.listing_type(ListingType::Community)
|
||||||
.sort(*sort_type)
|
.sort(*sort_type)
|
||||||
.community_id(community.id)
|
.community_id(community.id)
|
||||||
|
.limit(RSS_FETCH_LIMIT)
|
||||||
.list()?;
|
.list()?;
|
||||||
|
|
||||||
let items = create_post_items(posts, protocol_and_hostname)?;
|
let items = create_post_items(posts, protocol_and_hostname)?;
|
||||||
|
@ -248,6 +253,7 @@ fn get_feed_front(
|
||||||
.show_bot_accounts(local_user.show_bot_accounts)
|
.show_bot_accounts(local_user.show_bot_accounts)
|
||||||
.show_read_posts(local_user.show_read_posts)
|
.show_read_posts(local_user.show_read_posts)
|
||||||
.sort(*sort_type)
|
.sort(*sort_type)
|
||||||
|
.limit(RSS_FETCH_LIMIT)
|
||||||
.list()?;
|
.list()?;
|
||||||
|
|
||||||
let items = create_post_items(posts, protocol_and_hostname)?;
|
let items = create_post_items(posts, protocol_and_hostname)?;
|
||||||
|
@ -286,12 +292,14 @@ fn get_feed_inbox(
|
||||||
.my_person_id(person_id)
|
.my_person_id(person_id)
|
||||||
.show_bot_accounts(show_bot_accounts)
|
.show_bot_accounts(show_bot_accounts)
|
||||||
.sort(sort)
|
.sort(sort)
|
||||||
|
.limit(RSS_FETCH_LIMIT)
|
||||||
.list()?;
|
.list()?;
|
||||||
|
|
||||||
let mentions = PersonMentionQueryBuilder::create(conn)
|
let mentions = PersonMentionQueryBuilder::create(conn)
|
||||||
.recipient_id(person_id)
|
.recipient_id(person_id)
|
||||||
.my_person_id(person_id)
|
.my_person_id(person_id)
|
||||||
.sort(sort)
|
.sort(sort)
|
||||||
|
.limit(RSS_FETCH_LIMIT)
|
||||||
.list()?;
|
.list()?;
|
||||||
|
|
||||||
let items = create_reply_and_mention_items(replies, mentions, protocol_and_hostname)?;
|
let items = create_reply_and_mention_items(replies, mentions, protocol_and_hostname)?;
|
||||||
|
|
Loading…
Reference in a new issue