mirror of
https://github.com/discourse/discourse.git
synced 2024-12-01 09:24:37 +08:00
4fdb275683
Some of the changes in this commit are extracted from https://github.com/discourse/discourse/pull/17379. The bookmarks tab in the new user menu is different from the other tabs in that it can display a mixture of notifications and bookmarks. When there are unread bookmark reminder notifications, the tab displays all of these notifications at the top and fills the remaining space in the menu with the rest of the bookmarks. The bubble/badge count on the bookmarks tab indicates how many unread bookmark reminder notifications there are. On the technical aspect, since this commit introduces a new `bookmark-item` component, we've done some refactoring so that all 3 "item" components (`notification-item`, `reviewable-item` and the new `bookmark-item`) inherit from a base component and get identical HTML structure so they all look consistent. Internal tickets: t70584 and t65045.
21 lines
473 B
Ruby
21 lines
473 B
Ruby
# frozen_string_literal: true
|
|
|
|
class UserBookmarkListSerializer < ApplicationSerializer
|
|
attributes :more_bookmarks_url, :bookmarks
|
|
|
|
def bookmarks
|
|
object.bookmarks.map do |bm|
|
|
bm.registered_bookmarkable.serializer.new(
|
|
bm,
|
|
**object.bookmark_serializer_opts,
|
|
scope: scope,
|
|
root: false
|
|
)
|
|
end
|
|
end
|
|
|
|
def include_more_bookmarks_url?
|
|
@include_more_bookmarks_url ||= object.bookmarks.size == object.per_page
|
|
end
|
|
end
|