mirror of
https://github.com/LemmyNet/lemmy
synced 2024-11-10 06:54:12 +00:00
parent
ae9f82b452
commit
4d9c16a336
1 changed files with 6 additions and 2 deletions
|
@ -49,14 +49,18 @@ fn queries<'a>() -> Queries<
|
||||||
let list = move |mut conn: DbConn<'a>, options: PrivateMessageReportQuery| async move {
|
let list = move |mut conn: DbConn<'a>, options: PrivateMessageReportQuery| async move {
|
||||||
let mut query = all_joins(private_message_report::table.into_boxed());
|
let mut query = all_joins(private_message_report::table.into_boxed());
|
||||||
|
|
||||||
|
// If viewing all reports, order by newest, but if viewing unresolved only, show the oldest first (FIFO)
|
||||||
if options.unresolved_only {
|
if options.unresolved_only {
|
||||||
query = query.filter(private_message_report::resolved.eq(false));
|
query = query
|
||||||
|
.filter(private_message_report::resolved.eq(false))
|
||||||
|
.order_by(private_message_report::published.asc());
|
||||||
|
} else {
|
||||||
|
query = query.order_by(private_message_report::published.desc());
|
||||||
}
|
}
|
||||||
|
|
||||||
let (limit, offset) = limit_and_offset(options.page, options.limit)?;
|
let (limit, offset) = limit_and_offset(options.page, options.limit)?;
|
||||||
|
|
||||||
query
|
query
|
||||||
.order_by(private_message::published.asc())
|
|
||||||
.limit(limit)
|
.limit(limit)
|
||||||
.offset(offset)
|
.offset(offset)
|
||||||
.load::<PrivateMessageReportView>(&mut conn)
|
.load::<PrivateMessageReportView>(&mut conn)
|
||||||
|
|
Loading…
Reference in a new issue