Sha256: 69921648a3fb9e8685d344ae12a5ee530b6f0f1e16fbc5793078a35cda2340a7

Contents?: true

Size: 843 Bytes

Versions: 28

Compression:

Stored size: 843 Bytes

Contents

module Workarea
  module Admin
    class CommentMailer < Admin::ApplicationMailer
      def notify(user_id, comment_id)
        @user = User.find(user_id) rescue nil
        return false unless @user&.email.present?

        model = Comment.where(id: comment_id).first
        return false unless model.present?

        return false if model.author_id == user_id

        @comment = CommentViewModel.new(model)
        @commentable = model.commentable
        @comments = CommentViewModel.wrap(
          @commentable.comments.except(comment_id).to_a
        )

        set_colors

        mail(
          to: @user.email,
          from: Workarea.config.email_from,
          subject: t(
            'workarea.admin.comment_mailer.notify.subject',
            commentable: @commentable.name
          )
        )
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
workarea-admin-3.5.27 app/mailers/workarea/admin/comment_mailer.rb
workarea-admin-3.5.26 app/mailers/workarea/admin/comment_mailer.rb
workarea-admin-3.5.25 app/mailers/workarea/admin/comment_mailer.rb
workarea-admin-3.5.23 app/mailers/workarea/admin/comment_mailer.rb
workarea-admin-3.5.22 app/mailers/workarea/admin/comment_mailer.rb
workarea-admin-3.5.21 app/mailers/workarea/admin/comment_mailer.rb
workarea-admin-3.5.20 app/mailers/workarea/admin/comment_mailer.rb
workarea-admin-3.5.19 app/mailers/workarea/admin/comment_mailer.rb
workarea-admin-3.5.18 app/mailers/workarea/admin/comment_mailer.rb
workarea-admin-3.5.17 app/mailers/workarea/admin/comment_mailer.rb
workarea-admin-3.5.16 app/mailers/workarea/admin/comment_mailer.rb
workarea-admin-3.5.15 app/mailers/workarea/admin/comment_mailer.rb
workarea-admin-3.5.14 app/mailers/workarea/admin/comment_mailer.rb
workarea-admin-3.5.13 app/mailers/workarea/admin/comment_mailer.rb
workarea-admin-3.5.12 app/mailers/workarea/admin/comment_mailer.rb
workarea-admin-3.5.11 app/mailers/workarea/admin/comment_mailer.rb
workarea-admin-3.5.10 app/mailers/workarea/admin/comment_mailer.rb
workarea-admin-3.5.9 app/mailers/workarea/admin/comment_mailer.rb
workarea-admin-3.5.8 app/mailers/workarea/admin/comment_mailer.rb
workarea-admin-3.5.7 app/mailers/workarea/admin/comment_mailer.rb