discourse/app/serializers/user_bookmark_list_serializer.rb
Martin Brennan c07dd0d22a
FEATURE: Add lazy loading to user bookmarks list (#9317)
This is so users with huge amount of bookmarks do not have to wait a long time to see results.

* Add a bookmark list and list serializer to server-side to be able to handle paging and load more URL
* Use load-more component to load more bookmark items, 20 at a time in user activity
* Change the way current user is loaded for bookmark ember models because it was breaking/losing resolvedTimezone when loading more items
2020-04-01 14:09:07 +10:00

12 lines
287 B
Ruby

# frozen_string_literal: true
class UserBookmarkListSerializer < ApplicationSerializer
attributes :more_bookmarks_url
has_many :bookmarks, serializer: UserBookmarkSerializer, embed: :objects
def include_more_bookmarks_url?
object.bookmarks.size == object.per_page
end
end