Module: UserTagNotificationsMixin

Included in:
CurrentUserSerializer, UserSerializer, UserTagNotificationsSerializer
Defined in:
app/serializers/concerns/user_tag_notifications_mixin.rb

Instance Method Summary collapse

Instance Method Details

#muted_tagsObject



4
5
6
# File 'app/serializers/concerns/user_tag_notifications_mixin.rb', line 4

def muted_tags
  tags_with_notification_level(:muted)
end

#regular_tagsObject



20
21
22
# File 'app/serializers/concerns/user_tag_notifications_mixin.rb', line 20

def regular_tags
  tags_with_notification_level(:regular)
end

#tag_user_notification_levelsObject



30
31
32
# File 'app/serializers/concerns/user_tag_notifications_mixin.rb', line 30

def tag_user_notification_levels
  @tag_user_notification_levels ||= TagUser.notification_levels_for(user)
end

#tags_with_notification_level(lookup_level) ⇒ Object



24
25
26
27
28
# File 'app/serializers/concerns/user_tag_notifications_mixin.rb', line 24

def tags_with_notification_level(lookup_level)
  tag_user_notification_levels
    .select { |id, level| level == TagUser.notification_levels[lookup_level] }
    .keys
end

#tracked_tagsObject



8
9
10
# File 'app/serializers/concerns/user_tag_notifications_mixin.rb', line 8

def tracked_tags
  tags_with_notification_level(:tracking)
end

#watched_tagsObject



16
17
18
# File 'app/serializers/concerns/user_tag_notifications_mixin.rb', line 16

def watched_tags
  tags_with_notification_level(:watching)
end

#watching_first_post_tagsObject



12
13
14
# File 'app/serializers/concerns/user_tag_notifications_mixin.rb', line 12

def 
  tags_with_notification_level(:watching_first_post)
end