mirror of
https://github.com/dergigi/boris.git
synced 2026-01-22 08:14:25 +01:00
fix(bookmarks): sort by display time (created_at || listUpdatedAt) desc; nulls last
This commit is contained in:
@@ -352,9 +352,9 @@ class BookmarkController {
|
||||
urlReferences: extractUrlsFromContent(b.content)
|
||||
}))
|
||||
.sort((a, b) => {
|
||||
// Sort by listUpdatedAt desc, nulls last
|
||||
const aTs = a.listUpdatedAt ?? -Infinity
|
||||
const bTs = b.listUpdatedAt ?? -Infinity
|
||||
// Sort by display time: created_at, else listUpdatedAt. Newest first. Nulls last.
|
||||
const aTs = (a.created_at ?? a.listUpdatedAt ?? -Infinity)
|
||||
const bTs = (b.created_at ?? b.listUpdatedAt ?? -Infinity)
|
||||
return bTs - aTs
|
||||
})
|
||||
|
||||
|
||||
@@ -87,13 +87,8 @@ export const renderParsedContent = (parsedContent: ParsedContent) => {
|
||||
|
||||
// Sorting and grouping for bookmarks
|
||||
export const sortIndividualBookmarks = (items: IndividualBookmark[]) => {
|
||||
return items
|
||||
.slice()
|
||||
.sort((a, b) => {
|
||||
const aTs = a.listUpdatedAt ?? -Infinity
|
||||
const bTs = b.listUpdatedAt ?? -Infinity
|
||||
return bTs - aTs
|
||||
})
|
||||
const getSortTime = (b: IndividualBookmark) => b.created_at ?? b.listUpdatedAt ?? -Infinity
|
||||
return items.slice().sort((a, b) => getSortTime(b) - getSortTime(a))
|
||||
}
|
||||
|
||||
export function groupIndividualBookmarks(items: IndividualBookmark[]) {
|
||||
|
||||
Reference in New Issue
Block a user