mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 00:04:11 +08:00
6be4699954
We changed (https://github.com/discourse/discourse/pull/13407) behaviour of the topic level bookmark button recently. That PR made the button be opening the edit bookmark modal when there is only one bookmark on the topic instead of just removing that bookmark as it was before. This PR fixes the next problems that weren't taken into account in the previous PR: 1. Everything should work fine even on very big topics when a bookmarked post is unloaded from the post stream. I've added code that loads the post we need and makes everything work as expected 2. When at least one bookmark on the topic has a reminder, we should always be showing the icon with a clock on the topic level bookmark button 3. We should show correct tooltips for the topic level bookmark button
44 lines
830 B
Ruby
44 lines
830 B
Ruby
# frozen_string_literal: true
|
|
|
|
class WebHookTopicViewSerializer < TopicViewSerializer
|
|
attributes :created_by,
|
|
:last_poster
|
|
|
|
%i{
|
|
post_stream
|
|
timeline_lookup
|
|
pm_with_non_human_user
|
|
draft
|
|
draft_key
|
|
draft_sequence
|
|
message_bus_last_id
|
|
suggested_topics
|
|
has_summary
|
|
actions_summary
|
|
current_post_number
|
|
chunk_size
|
|
topic_timer
|
|
details
|
|
image_url
|
|
slow_mode_seconds
|
|
slow_mode_enabled_until
|
|
bookmarked_posts
|
|
}.each do |attr|
|
|
define_method("include_#{attr}?") do
|
|
false
|
|
end
|
|
end
|
|
|
|
def include_show_read_indicator?
|
|
false
|
|
end
|
|
|
|
def created_by
|
|
BasicUserSerializer.new(object.topic.user, scope: scope, root: false)
|
|
end
|
|
|
|
def last_poster
|
|
BasicUserSerializer.new(object.topic.last_poster, scope: scope, root: false)
|
|
end
|
|
end
|