mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: display unpinned state, allow unpinning by clicking on pin
This commit is contained in:
@@ -31,6 +31,7 @@ class TopicViewSerializer < ApplicationSerializer
|
||||
:draft_sequence,
|
||||
:starred,
|
||||
:posted,
|
||||
:unpinned,
|
||||
:pinned, # Is topic pinned and viewer hasn't cleared the pin?
|
||||
:pinned_at, # Ignores clear pin
|
||||
:details,
|
||||
@@ -41,7 +42,7 @@ class TopicViewSerializer < ApplicationSerializer
|
||||
:expandable_first_post
|
||||
|
||||
# Define a delegator for each attribute of the topic we want
|
||||
attributes *topic_attributes
|
||||
attributes(*topic_attributes)
|
||||
topic_attributes.each do |ta|
|
||||
class_eval %{def #{ta}
|
||||
object.topic.#{ta}
|
||||
@@ -145,7 +146,11 @@ class TopicViewSerializer < ApplicationSerializer
|
||||
alias_method :include_posted?, :has_topic_user?
|
||||
|
||||
def pinned
|
||||
PinnedCheck.new(object.topic, object.topic_user).pinned?
|
||||
PinnedCheck.pinned?(object.topic, object.topic_user)
|
||||
end
|
||||
|
||||
def unpinned
|
||||
PinnedCheck.unpinned?(object.topic, object.topic_user)
|
||||
end
|
||||
|
||||
def pinned_at
|
||||
|
||||
Reference in New Issue
Block a user