Order attachments by creation date when new post is created
This commit is contained in:
parent
9a32fb9c80
commit
dbca8183bb
2 changed files with 3 additions and 1 deletions
|
@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||
|
||||
- Process queued background jobs before re-trying stalled.
|
||||
- Remove activity from queue if handler times out.
|
||||
- Order attachments by creation date when new post is created.
|
||||
|
||||
## [1.19.0] - 2023-03-30
|
||||
|
||||
|
|
|
@ -57,9 +57,10 @@ async fn create_post_attachments(
|
|||
// Some attachments were not found
|
||||
return Err(DatabaseError::NotFound("attachment"));
|
||||
};
|
||||
let attachments = attachments_rows.iter()
|
||||
let mut attachments: Vec<DbMediaAttachment> = attachments_rows.iter()
|
||||
.map(|row| row.try_get("media_attachment"))
|
||||
.collect::<Result<_, _>>()?;
|
||||
attachments.sort_by(|a, b| a.created_at.cmp(&b.created_at));
|
||||
Ok(attachments)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue