Sha256: 587529fe24bd0ba55d51a65b4c141398d9e51d56818856f1156ff3f0270eeb55
Contents?: true
Size: 1.4 KB
Versions: 6
Compression:
Stored size: 1.4 KB
Contents
# frozen_string_literal: true module Decidim module Comments # A custom mailer for sending notifications to users when # a comment is created. class CommentNotificationMailer < Decidim::ApplicationMailer helper Decidim::ResourceHelper helper_method :commentable_title def comment_created(comment, commentable) with_user(commentable.author) do @comment = comment @commentable = commentable @locator = Decidim::ResourceLocatorPresenter.new(@commentable) @organization = commentable.organization subject = I18n.t("comment_created.subject", scope: "decidim.comments.mailer.comment_notification") mail(to: commentable.author.email, subject: subject) end end def reply_created(reply, comment, commentable) with_user(comment.author) do @reply = reply @comment = comment @commentable = commentable @locator = Decidim::ResourceLocatorPresenter.new(@commentable) @organization = commentable.organization subject = I18n.t("reply_created.subject", scope: "decidim.comments.mailer.comment_notification") mail(to: comment.author.email, subject: subject) end end private def commentable_title @commentable.title.is_a?(Hash) ? @commentable.title[I18n.locale.to_s] : @commentable.title end end end end
Version data entries
6 entries across 6 versions & 2 rubygems