It's a convention in rails to name your mailers with a Mailer suffix, and is also common to name the class after the recipient (e.g. User, Admin). So UserMailer seems a reasonable choice.
- 'app/controllers/users_controller.rb'
- 'app/helpers/application_helper.rb'
- 'app/helpers/browse_tags_helper.rb'
- - 'app/mailers/notifier.rb'
+ - 'app/mailers/user_mailer.rb'
- 'app/models/client_application.rb'
- 'lib/nominatim.rb'
- 'lib/osm.rb'
Exclude:
- 'app/helpers/title_helper.rb'
-# Offense count: 1
-# Cop supports --auto-correct.
-# Configuration parameters: Include.
-# Include: app/mailers/**/*.rb
-Rails/MailerName:
- Exclude:
- - 'app/mailers/notifier.rb'
-
# Offense count: 5
# Configuration parameters: Include.
# Include: db/migrate/*.rb
# Notify current subscribers of the new comment
changeset.subscribers.visible.each do |user|
- Notifier.changeset_comment_notification(comment, user).deliver_later if current_user != user
+ UserMailer.changeset_comment_notification(comment, user).deliver_later if current_user != user
end
# Add the commenter to the subscribers if necessary
comment = note.comments.create!(attributes)
note.comments.map(&:author).uniq.each do |user|
- Notifier.note_comment_notification(comment, user).deliver_later if notify && user && user != current_user && user.visible?
+ UserMailer.note_comment_notification(comment, user).deliver_later if notify && user && user != current_user && user.visible?
end
end
end
# Notify current subscribers of the new comment
@entry.subscribers.visible.each do |user|
- Notifier.diary_comment_notification(@diary_comment, user).deliver_later if current_user != user
+ UserMailer.diary_comment_notification(@diary_comment, user).deliver_later if current_user != user
end
# Add the commenter to the subscribers if necessary
flash[:warning] = t "friendships.make_friend.already_a_friend", :name => @new_friend.display_name
elsif friendship.save
flash[:notice] = t "friendships.make_friend.success", :name => @new_friend.display_name
- Notifier.friendship_notification(friendship).deliver_later
+ UserMailer.friendship_notification(friendship).deliver_later
else
friendship.add_error(t("friendships.make_friend.failed", :name => @new_friend.display_name))
end
render :action => "new"
elsif @message.save
flash[:notice] = t ".message_sent"
- Notifier.message_notification(@message).deliver_later
+ UserMailer.message_notification(@message).deliver_later
redirect_to :action => :inbox
else
@title = t "messages.new.title"
successful_login(current_user)
else
session[:token] = current_user.tokens.create.token
- Notifier.signup_confirm(current_user, current_user.tokens.create(:referer => referer)).deliver_later
+ UserMailer.signup_confirm(current_user, current_user.tokens.create(:referer => referer)).deliver_later
redirect_to :action => "confirm", :display_name => current_user.display_name
end
else
if user
token = user.tokens.create
- Notifier.lost_password(user, token).deliver_later
+ UserMailer.lost_password(user, token).deliver_later
flash[:notice] = t "users.lost_password.notice email on way"
redirect_to :action => "login"
else
if user.nil? || token.nil? || token.user != user
flash[:error] = t "users.confirm_resend.failure", :name => params[:display_name]
else
- Notifier.signup_confirm(user, user.tokens.create).deliver_later
+ UserMailer.signup_confirm(user, user.tokens.create).deliver_later
flash[:notice] = t("users.confirm_resend.success", :email => user.email, :sender => Settings.support_email).html_safe
end
flash.now[:notice] = t "users.account.flash update success confirm needed"
begin
- Notifier.email_confirm(user, user.tokens.create).deliver_later
+ UserMailer.email_confirm(user, user.tokens.create).deliver_later
rescue StandardError
# Ignore errors sending email
end
-module NotifierHelper
+module UserMailerHelper
def fp(text)
format_paragraph(text, 72, 0)
end
gpx = trace.import
if gpx.actual_points.positive?
- Notifier.gpx_success(trace, gpx.actual_points).deliver
+ UserMailer.gpx_success(trace, gpx.actual_points).deliver
else
- Notifier.gpx_failure(trace, "0 points parsed ok. Do they all have lat,lng,alt,timestamp?").deliver
+ UserMailer.gpx_failure(trace, "0 points parsed ok. Do they all have lat,lng,alt,timestamp?").deliver
trace.destroy
end
rescue StandardError => e
logger.info e.to_s
e.backtrace.each { |l| logger.info l }
- Notifier.gpx_failure(trace, e.to_s + "\n" + e.backtrace.join("\n")).deliver
+ UserMailer.gpx_failure(trace, e.to_s + "\n" + e.backtrace.join("\n")).deliver
trace.destroy
end
end
-class Notifier < ApplicationMailer
+class UserMailer < ApplicationMailer
include ActionView::Helpers::AssetUrlHelper
self.delivery_job = ActionMailer::MailDeliveryJob
:confirm_string => token.token)
mail :to => user.email,
- :subject => I18n.t("notifier.signup_confirm.subject")
+ :subject => I18n.t("user_mailer.signup_confirm.subject")
end
end
:confirm_string => token.token)
mail :to => user.new_email,
- :subject => I18n.t("notifier.email_confirm.subject")
+ :subject => I18n.t("user_mailer.email_confirm.subject")
end
end
:token => token.token)
mail :to => user.email,
- :subject => I18n.t("notifier.lost_password.subject")
+ :subject => I18n.t("user_mailer.lost_password.subject")
end
end
@possible_points = possible_points
mail :to => trace.user.email,
- :subject => I18n.t("notifier.gpx_notification.success.subject")
+ :subject => I18n.t("user_mailer.gpx_notification.success.subject")
end
end
@error = error
mail :to => trace.user.email,
- :subject => I18n.t("notifier.gpx_notification.failure.subject")
+ :subject => I18n.t("user_mailer.gpx_notification.failure.subject")
end
end
mail :from => from_address(message.sender.display_name, "m", message.id, message.digest),
:to => message.recipient.email,
- :subject => I18n.t("notifier.message_notification.subject_header", :subject => message.title)
+ :subject => I18n.t("user_mailer.message_notification.subject_header", :subject => message.title)
end
end
mail :from => from_address(comment.user.display_name, "c", comment.id, comment.digest, recipient.id),
:to => recipient.email,
- :subject => I18n.t("notifier.diary_comment_notification.subject", :user => comment.user.display_name)
+ :subject => I18n.t("user_mailer.diary_comment_notification.subject", :user => comment.user.display_name)
end
end
attach_user_avatar(@friendship.befriender)
mail :to => friendship.befriendee.email,
- :subject => I18n.t("notifier.friendship_notification.subject", :user => friendship.befriender.display_name)
+ :subject => I18n.t("user_mailer.friendship_notification.subject", :user => friendship.befriender.display_name)
end
end
@commenter = if comment.author
comment.author.display_name
else
- I18n.t("notifier.note_comment_notification.anonymous")
+ I18n.t("user_mailer.note_comment_notification.anonymous")
end
@author = @commenter
set_references("note", comment.note)
subject = if @owner
- I18n.t("notifier.note_comment_notification.#{@event}.subject_own", :commenter => @commenter)
+ I18n.t("user_mailer.note_comment_notification.#{@event}.subject_own", :commenter => @commenter)
else
- I18n.t("notifier.note_comment_notification.#{@event}.subject_other", :commenter => @commenter)
+ I18n.t("user_mailer.note_comment_notification.#{@event}.subject_other", :commenter => @commenter)
end
mail :to => recipient.email, :subject => subject
@author = @commenter
subject = if @owner
- I18n.t("notifier.changeset_comment_notification.commented.subject_own", :commenter => @commenter)
+ I18n.t("user_mailer.changeset_comment_notification.commented.subject_own", :commenter => @commenter)
else
- I18n.t("notifier.changeset_comment_notification.commented.subject_other", :commenter => @commenter)
+ I18n.t("user_mailer.changeset_comment_notification.commented.subject_other", :commenter => @commenter)
end
attach_user_avatar(comment.author)
+++ /dev/null
-<%= t "notifier.gpx_notification.your_gpx_file" %>
-<strong><%= @trace_name %></strong>
-<%= t "notifier.gpx_notification.with_description" %>
-<em><%= @trace_description %></em>
-<% if @trace_tags.length>0 %>
- <%= t "notifier.gpx_notification.and_the_tags" %>
- <em><% @trace_tags.each do |tag| %>
- <%= tag.tag.rstrip %>
- <% end %></em>
-<% else %>
- <%= t "notifier.gpx_notification.and_no_tags" %>
-<% end %>
+++ /dev/null
-<p><%= t "notifier.email_confirm_html.greeting" %></p>
-
-<p><%= t "notifier.email_confirm_html.hopefully_you", :server_url => Settings.server_url, :new_address => @address %></p>
-
-<p><%= t "notifier.email_confirm_html.click_the_link" %></p>
-
-<p><a href="<%= @url %>"><%= @url %></a></p>
+++ /dev/null
-<%= t 'notifier.email_confirm_plain.greeting' %>
-
-<%= word_wrap(t 'notifier.email_confirm_plain.hopefully_you', :server_url => Settings.server_url, :new_address => @address) %>
-
-<%= t 'notifier.email_confirm_plain.click_the_link' %>
-
-<%= @url %>
+++ /dev/null
-<p><%= t "notifier.gpx_notification.greeting" %></p>
-
-<p>
- <%= render :partial => "gpx_description" %>
- <%= t "notifier.gpx_notification.failure.failed_to_import" %>
-</p>
-
-<blockquote>
- <%= @error %>
-</blockquote>
-
-<p>
- <%= t "notifier.gpx_notification.failure.more_info_1" %>
- <%= t "notifier.gpx_notification.failure.more_info_2" %>
- <%= t "notifier.gpx_notification.failure.import_failures_url" %>
-</p>
+++ /dev/null
-<p><%= t "notifier.lost_password_html.greeting" %></p>
-
-<p><%= t "notifier.lost_password_html.hopefully_you" %></p>
-
-<p><%= t "notifier.lost_password_html.click_the_link" %></p>
-
-<p><a href="<%= @url %>"><%= @url %></a></p>
+++ /dev/null
-<%= t 'notifier.lost_password_plain.greeting' %>
-
-<%= word_wrap(t 'notifier.lost_password_plain.hopefully_you') %>
-
-<%= t 'notifier.lost_password_plain.click_the_link' %>
-
-<%= @url %>
--- /dev/null
+<%= t "user_mailer.gpx_notification.your_gpx_file" %>
+<strong><%= @trace_name %></strong>
+<%= t "user_mailer.gpx_notification.with_description" %>
+<em><%= @trace_description %></em>
+<% if @trace_tags.length>0 %>
+ <%= t "user_mailer.gpx_notification.and_the_tags" %>
+ <em><% @trace_tags.each do |tag| %>
+ <%= tag.tag.rstrip %>
+ <% end %></em>
+<% else %>
+ <%= t "user_mailer.gpx_notification.and_no_tags" %>
+<% end %>
--- /dev/null
+<p><%= t "user_mailer.email_confirm_html.greeting" %></p>
+
+<p><%= t "user_mailer.email_confirm_html.hopefully_you", :server_url => Settings.server_url, :new_address => @address %></p>
+
+<p><%= t "user_mailer.email_confirm_html.click_the_link" %></p>
+
+<p><a href="<%= @url %>"><%= @url %></a></p>
--- /dev/null
+<%= t 'user_mailer.email_confirm_plain.greeting' %>
+
+<%= word_wrap(t 'user_mailer.email_confirm_plain.hopefully_you', :server_url => Settings.server_url, :new_address => @address) %>
+
+<%= t 'user_mailer.email_confirm_plain.click_the_link' %>
+
+<%= @url %>
--- /dev/null
+<p><%= t "user_mailer.gpx_notification.greeting" %></p>
+
+<p>
+ <%= render :partial => "gpx_description" %>
+ <%= t "user_mailer.gpx_notification.failure.failed_to_import" %>
+</p>
+
+<blockquote>
+ <%= @error %>
+</blockquote>
+
+<p>
+ <%= t "user_mailer.gpx_notification.failure.more_info_1" %>
+ <%= t "user_mailer.gpx_notification.failure.more_info_2" %>
+ <%= t "user_mailer.gpx_notification.failure.import_failures_url" %>
+</p>
-<p><%= t "notifier.gpx_notification.greeting" %></p>
+<p><%= t "user_mailer.gpx_notification.greeting" %></p>
<p>
<%= render :partial => "gpx_description" %>
- <%= t("notifier.gpx_notification.success.loaded_successfully",
+ <%= t("user_mailer.gpx_notification.success.loaded_successfully",
:trace_points => @trace_points, :possible_points => @possible_points, :count => @possible_points) %>
</p>
--- /dev/null
+<p><%= t "user_mailer.lost_password_html.greeting" %></p>
+
+<p><%= t "user_mailer.lost_password_html.hopefully_you" %></p>
+
+<p><%= t "user_mailer.lost_password_html.click_the_link" %></p>
+
+<p><a href="<%= @url %>"><%= @url %></a></p>
--- /dev/null
+<%= t 'user_mailer.lost_password_plain.greeting' %>
+
+<%= word_wrap(t 'user_mailer.lost_password_plain.hopefully_you') %>
+
+<%= t 'user_mailer.lost_password_plain.click_the_link' %>
+
+<%= @url %>
text: Make a Donation
learn_more: "Learn More"
more: More
- notifier:
+ user_mailer:
diary_comment_notification:
subject: "[OpenStreetMap] %{user} commented on a diary entry"
hi: "Hi %{to_user},"
full <a href="https://opendatacommons.org/licenses/odbl/1.0/">legal
code</a> explains your rights and responsibilities.
intro_3_1_html: |
- Our documentation is licensed under the
+ Our documentation is licensed under the
<a href="https://creativecommons.org/licenses/by-sa/2.0/">Creative
Commons Attribution-ShareAlike 2.0</a> license (CC BY-SA 2.0).
credit_title_html: How to credit OpenStreetMap
direct your readers to openstreetmap.org (perhaps by expanding
'OpenStreetMap' to this full address) and to opendatacommons.org.
credit_3_1_html: |
- The map tiles in the “standard style” at www.openstreetmap.org are a
- Produced Work by the OpenStreetMap Foundation using OpenStreetMap data
- under the Open Database License. If you are using these tiles please use
- the following attribution:
- “Base map and data from OpenStreetMap and OpenStreetMap Foundation”.
+ The map tiles in the “standard style” at www.openstreetmap.org are a
+ Produced Work by the OpenStreetMap Foundation using OpenStreetMap data
+ under the Open Database License. If you are using these tiles please use
+ the following attribution:
+ “Base map and data from OpenStreetMap and OpenStreetMap Foundation”.
credit_4_html: |
For a browsable electronic map, the credit should appear in the corner of the map.
For example: