mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-22 04:11:17 +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 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 {
|
||||
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)?;
|
||||
|
||||
query
|
||||
.order_by(private_message::published.asc())
|
||||
.limit(limit)
|
||||
.offset(offset)
|
||||
.load::<PrivateMessageReportView>(&mut conn)
|
||||
|
|
Loading…
Reference in a new issue