Also order reports by oldest first (ref #4123) (#4129)

This commit is contained in:
Nutomic 2023-11-06 11:29:30 +01:00 committed by GitHub
parent adef3479c0
commit cf788334aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View file

@ -112,7 +112,7 @@ fn queries<'a>() -> Queries<
let (limit, offset) = limit_and_offset(options.page, options.limit)?; let (limit, offset) = limit_and_offset(options.page, options.limit)?;
query = query query = query
.order_by(comment_report::published.desc()) .order_by(comment_report::published.asc())
.limit(limit) .limit(limit)
.offset(offset); .offset(offset);
@ -476,8 +476,8 @@ mod tests {
assert_eq!( assert_eq!(
reports, reports,
[ [
expected_sara_report_view.clone(),
expected_jessica_report_view.clone(), expected_jessica_report_view.clone(),
expected_sara_report_view.clone()
] ]
); );

View file

@ -90,7 +90,7 @@ fn queries<'a>() -> Queries<
let (limit, offset) = limit_and_offset(options.page, options.limit)?; let (limit, offset) = limit_and_offset(options.page, options.limit)?;
query = query query = query
.order_by(post_report::published.desc()) .order_by(post_report::published.asc())
.limit(limit) .limit(limit)
.offset(offset); .offset(offset);
@ -337,8 +337,8 @@ mod tests {
.await .await
.unwrap(); .unwrap();
assert_eq!(reports[0].creator.id, inserted_jessica.id); assert_eq!(reports[0].creator.id, inserted_sara.id);
assert_eq!(reports[1].creator.id, inserted_sara.id); assert_eq!(reports[1].creator.id, inserted_jessica.id);
// Make sure the counts are correct // Make sure the counts are correct
let report_count = PostReportView::get_report_count(pool, inserted_timmy.id, false, None) let report_count = PostReportView::get_report_count(pool, inserted_timmy.id, false, None)

View file

@ -56,7 +56,7 @@ fn queries<'a>() -> Queries<
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.desc()) .order_by(private_message::published.asc())
.limit(limit) .limit(limit)
.offset(offset) .offset(offset)
.load::<PrivateMessageReportView>(&mut conn) .load::<PrivateMessageReportView>(&mut conn)