Class: PinnedCheck
- Inherits:
-
Object
- Object
- PinnedCheck
- Defined in:
- lib/pinned_check.rb
Overview
Helps us determine whether a topic should be displayed as pinned or not, taking into account anonymous users and users who have dismissed it
Class Method Summary collapse
Class Method Details
.pinned?(topic, topic_user = nil) ⇒ Boolean
11 12 13 |
# File 'lib/pinned_check.rb', line 11 def self.pinned?(topic, topic_user = nil) !!topic.pinned_at && !unpinned?(topic, topic_user) end |
.unpinned?(topic, topic_user = nil) ⇒ Boolean
6 7 8 9 |
# File 'lib/pinned_check.rb', line 6 def self.unpinned?(topic, topic_user = nil) topic.pinned_at && topic_user && topic_user.cleared_pinned_at && topic_user.cleared_pinned_at > topic.pinned_at end |