mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-10-01 01:36:12 -04:00
parent
ae9f82b452
commit
4d9c16a336
@ -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 New Issue
Block a user