Sha256: b08d316bf54bba3ae2744d588378a7a43f1053d8cf6cc0ac65360c6c84e98f06

Contents?: true

Size: 461 Bytes

Versions: 6

Compression:

Stored size: 461 Bytes

Contents

# frozen_string_literal: true
module Thredded
  class NotifyFollowingUsers
    def initialize(post)
      @post = post
    end

    def run
      return if targeted_users.empty?
      PostMailer.post_notification(@post.id, targeted_users.map(&:email)).deliver_now
      MembersMarkedNotified.new(@post, targeted_users).run
    end

    def targeted_users
      @targeted_users ||= @post.postable.following_users.reject { |u| u == @post.user }
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
thredded-0.6.3 app/commands/thredded/notify_following_users.rb
thredded-0.6.2 app/commands/thredded/notify_following_users.rb
thredded-0.6.1 app/commands/thredded/notify_following_users.rb
thredded-0.6.0 app/commands/thredded/notify_following_users.rb
thredded-0.5.1 app/commands/thredded/notify_following_users.rb
thredded-0.5.0 app/commands/thredded/notify_following_users.rb