Move local feed before federated feed for non-logged-in users

This commit is contained in:
Kitaiti Makoto 2022-05-07 12:48:34 +09:00
parent c32acb2fcf
commit 770c77ee81

View File

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