Sha256: 4755b8c28ef7c8210f3580dfb41d8526b5ba693149938fac4fcfa5c9205c60b5
Contents?: true
Size: 884 Bytes
Versions: 2
Compression:
Stored size: 884 Bytes
Contents
# frozen_string_literal: true require_dependency 'thredded/at_notification_extractor' module Thredded class AutofollowMentionedUsers def initialize(post) @post = post end def run autofollowers.each do |user| Thredded::UserTopicFollow.create_unless_exists(user.id, post.postable_id, :mentioned) end end def autofollowers autofollowers = Thredded::AtNotificationExtractor.new(post).run autofollowers.delete(post.user) exclude_those_opting_out_of_at_notifications autofollowers end private attr_reader :post def exclude_those_opting_out_of_at_notifications(members) members.select do |member| member.thredded_user_preference.follow_topics_on_mention? && member.thredded_user_messageboard_preferences.in(post.messageboard).follow_topics_on_mention? end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
thredded-0.8.4 | app/commands/thredded/autofollow_mentioned_users.rb |
thredded-0.8.2 | app/commands/thredded/autofollow_mentioned_users.rb |