Sha256: a4a0ddd6eda1db66cbc6ecc7a42d2b4d432e61d8542503308b8ce7f4224493ef
Contents?: true
Size: 1.22 KB
Versions: 13
Compression:
Stored size: 1.22 KB
Contents
# frozen_string_literal: true # Copyright (c) 2008-2013 Michael Dvorkin and contributors. # # Fat Free CRM is freely distributable under the terms of MIT license. # See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php #------------------------------------------------------------------------------ class SubscriptionMailer < ActionMailer::Base def comment_notification(user, comment) @entity = comment.commentable @entity_type = @entity.class.to_s @entity_name = @entity.respond_to?(:full_name) ? @entity.full_name : @entity.name @comment = comment @user = comment.user # If entity has tags, join them and wrap in parantheses subject = "RE: [#{@entity_type.downcase}:#{@entity.id}] #{@entity_name}" subject += " (#{@entity.tags.join(', ')})" if @entity.tags.any? mail subject: subject, to: user.email, from: from_address(@user), date: Time.now end private def from_address(user = nil) address = Setting.dig(:email_comment_replies, :address).presence || Setting.dig(:smtp, :from).presence || "noreply@fatfreecrm.com" address = "#{user.full_name} <#{address}>" if user && !address.match(/<.+>\z/) address end end
Version data entries
13 entries across 13 versions & 1 rubygems