Move My feed first in timelines
This commit is contained in:
parent
57551610e2
commit
70b5bee00f
@ -6,6 +6,7 @@ use crate::{
|
|||||||
Connection, Error, Result,
|
Connection, Error, Result,
|
||||||
};
|
};
|
||||||
use diesel::{self, BoolExpressionMethods, ExpressionMethods, QueryDsl, RunQueryDsl};
|
use diesel::{self, BoolExpressionMethods, ExpressionMethods, QueryDsl, RunQueryDsl};
|
||||||
|
use std::cmp::Ordering;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
|
||||||
pub(crate) mod query;
|
pub(crate) mod query;
|
||||||
@ -85,6 +86,16 @@ 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 {
|
||||||
|
Ordering::Equal
|
||||||
|
}
|
||||||
|
});
|
||||||
|
timelines
|
||||||
|
})
|
||||||
.map_err(Error::from)
|
.map_err(Error::from)
|
||||||
} else {
|
} else {
|
||||||
timeline_definition::table
|
timeline_definition::table
|
||||||
|
Loading…
Reference in New Issue
Block a user