Merge pull request 'Move local feed before federated feed for non-logged-in users' (#1072) from timeline-order into main

Reviewed-on: https://git.joinplu.me/Plume/Plume/pulls/1072
This commit is contained in:
KitaitiMakoto 2022-05-07 16:35:28 +00:00
commit d95549f58b

View File

@ -86,6 +86,13 @@ impl Timeline {
.or(timeline_definition::user_id.is_null()), .or(timeline_definition::user_id.is_null()),
) )
.load::<Self>(conn) .load::<Self>(conn)
.map_err(Error::from)
} else {
timeline_definition::table
.filter(timeline_definition::user_id.is_null())
.load::<Self>(conn)
.map_err(Error::from)
}
.map(|mut timelines| { .map(|mut timelines| {
timelines.sort_by(|t1, t2| { timelines.sort_by(|t1, t2| {
if t1.user_id.is_some() && t2.user_id.is_none() { if t1.user_id.is_some() && t2.user_id.is_none() {
@ -96,13 +103,6 @@ impl Timeline {
}); });
timelines timelines
}) })
.map_err(Error::from)
} else {
timeline_definition::table
.filter(timeline_definition::user_id.is_null())
.load::<Self>(conn)
.map_err(Error::from)
}
} }
pub fn new_for_user( pub fn new_for_user(