Merge pull request #1155 from metamaps/bug/fix.emails
fix map activity emails
This commit is contained in:
commit
e195b89bbd
3 changed files with 36 additions and 14 deletions
|
@ -15,22 +15,22 @@
|
||||||
<%= link_to @map.name, map_url(@map) %>
|
<%= link_to @map.name, map_url(@map) %>
|
||||||
</p>
|
</p>
|
||||||
<div>
|
<div>
|
||||||
<% if @summary_data[:stats][:messages_sent] > 0 %>
|
<% if @summary_data[:stats][:messages_sent] %>
|
||||||
<p style="margin:6px 0;color:#a354cd;"><%= pluralize(@summary_data[:stats][:messages_sent], 'message') %></p>
|
<p style="margin:6px 0;color:#a354cd;"><%= pluralize(@summary_data[:stats][:messages_sent], 'message') %></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if @summary_data[:stats][:topics_added] > 0 %>
|
<% if @summary_data[:stats][:topics_added] %>
|
||||||
<p style="margin:6px 0;color:#4FC059;"><%= pluralize(@summary_data[:stats][:topics_added], 'topic') %> added</p>
|
<p style="margin:6px 0;color:#4FC059;"><%= pluralize(@summary_data[:stats][:topics_added], 'topic') %> added</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if @summary_data[:stats][:synapses_added] > 0 %>
|
<% if @summary_data[:stats][:synapses_added] %>
|
||||||
<p style="margin:6px 0;color:#4FC059;"><%= pluralize(@summary_data[:stats][:synapses_added], 'synapse') %> added</p>
|
<p style="margin:6px 0;color:#4FC059;"><%= pluralize(@summary_data[:stats][:synapses_added], 'synapse') %> added</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if @summary_data[:stats][:topics_moved] > 0 %>
|
<% if @summary_data[:stats][:topics_moved] %>
|
||||||
<p style="margin:6px 0;color:#00BCD4;"><%= pluralize(@summary_data[:stats][:topics_moved], 'topic') %> moved</p>
|
<p style="margin:6px 0;color:#00BCD4;"><%= pluralize(@summary_data[:stats][:topics_moved], 'topic') %> moved</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if @summary_data[:stats][:topics_removed] > 0 %>
|
<% if @summary_data[:stats][:topics_removed] %>
|
||||||
<p style="margin:6px 0;color:#c04f4f;"><%= pluralize(@summary_data[:stats][:topics_removed], 'topic') %> removed</p>
|
<p style="margin:6px 0;color:#c04f4f;"><%= pluralize(@summary_data[:stats][:topics_removed], 'topic') %> removed</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if @summary_data[:stats][:synapses_removed] > 0 %>
|
<% if @summary_data[:stats][:synapses_removed] %>
|
||||||
<p style="margin:6px 0;color:#c04f4f;"><%= pluralize(@summary_data[:stats][:synapses_removed], 'synapse') %> removed</p>
|
<p style="margin:6px 0;color:#c04f4f;"><%= pluralize(@summary_data[:stats][:synapses_removed], 'synapse') %> removed</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
@ -61,7 +61,7 @@
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
<% if @summary_data[:topics_removed] || @summary_data[:synapses_removed] %>
|
<% if @summary_data[:topics_removed] || @summary_data[:synapses_removed] %>
|
||||||
<div style="background:rgba(192, 79, 79, 0.2); padding:8px;">
|
<div style="background:rgba(192, 79, 79, 0.2); padding:8px;">
|
||||||
<% if @summary_data[:topics_removed] %>
|
<% if @summary_data[:topics_removed] %>
|
||||||
|
|
|
@ -1,9 +1,14 @@
|
||||||
Delayed::Worker.class_eval do
|
# frozen_string_literal: true
|
||||||
|
|
||||||
def handle_failed_job_with_notification(job, error)
|
|
||||||
handle_failed_job_without_notification(job, error)
|
|
||||||
ExceptionNotifier.notify_exception(error)
|
|
||||||
end
|
|
||||||
alias_method_chain :handle_failed_job, :notification
|
|
||||||
|
|
||||||
|
module ExceptionNotifierInDelayedJob
|
||||||
|
def handle_failed_job(job, error)
|
||||||
|
super
|
||||||
|
ExceptionNotfier.notify_exception(error)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Delayed::Worker.class_eval do
|
||||||
|
prepend ExceptionNotifierInDelayedJob
|
||||||
|
end
|
||||||
|
|
||||||
|
Delayed::Worker.logger = Logger.new(File.join(Rails.root, 'log', 'delayed_job.log'))
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe 'map_activity_mailer/daily_summary.html.erb' do
|
||||||
|
it 'displays messages sent' do
|
||||||
|
assign(:user, create(:user))
|
||||||
|
assign(:map, create(:map))
|
||||||
|
assign(:summary_data, stats: {
|
||||||
|
messages_sent: 5
|
||||||
|
})
|
||||||
|
|
||||||
|
render
|
||||||
|
|
||||||
|
expect(rendered).to match(/5 messages/)
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue