From 606bfedb916c21a628331a000fce966c43cdbe00 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Tue, 29 Nov 2016 12:52:25 -0500 Subject: [PATCH] ok, the mailboxer emails mostly work --- app/controllers/access_controller.rb | 4 ++-- .../notification_mailer/new_notification_email.html.erb | 3 +-- .../notification_mailer/new_notification_email.text.erb | 3 +-- app/views/notifications/index.html.erb | 2 +- app/views/notifications/show.html.erb | 2 +- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/app/controllers/access_controller.rb b/app/controllers/access_controller.rb index a0271981..5f19d23e 100644 --- a/app/controllers/access_controller.rb +++ b/app/controllers/access_controller.rb @@ -22,7 +22,7 @@ class AccessController < ApplicationController request = AccessRequest.create(user: current_user, map: @map) # what about push notification to map owner? mail = MapMailer.access_request_email(request, @map) - @map.user.notify(mail.subject, mail.body) + @map.user.notify(mail.subject, mail.body.parts[1].body.to_s) respond_to do |format| format.json do @@ -40,7 +40,7 @@ class AccessController < ApplicationController # who we then send an email to user = User.find(user_id) mail = MapMailer.invite_to_edit_email(@map, current_user, User.find(user_id)) - user.notify(mail.subject, mail.body) + user.notify(mail.subject, mail.body.parts[1].body.to_s) end @map.remove_old_collaborators(user_ids) diff --git a/app/views/mailboxer/notification_mailer/new_notification_email.html.erb b/app/views/mailboxer/notification_mailer/new_notification_email.html.erb index 23ee4087..ac4af493 100644 --- a/app/views/mailboxer/notification_mailer/new_notification_email.html.erb +++ b/app/views/mailboxer/notification_mailer/new_notification_email.html.erb @@ -4,7 +4,6 @@ - <% binding.pry %> - <%= raw @notification.body.parts[1].encoded %> + <%= raw @notification.body %> diff --git a/app/views/mailboxer/notification_mailer/new_notification_email.text.erb b/app/views/mailboxer/notification_mailer/new_notification_email.text.erb index fa39d477..1c230d08 100644 --- a/app/views/mailboxer/notification_mailer/new_notification_email.text.erb +++ b/app/views/mailboxer/notification_mailer/new_notification_email.text.erb @@ -1,2 +1 @@ -<% body = @notification.body.parts[0].encoded %> -<%= body.html_safe? ? body : strip_tags(body) %> +<%= @notification.body.html_safe? ? @notification.body : strip_tags(@notification.body) %> diff --git a/app/views/notifications/index.html.erb b/app/views/notifications/index.html.erb index eb576ce6..bd8022e5 100644 --- a/app/views/notifications/index.html.erb +++ b/app/views/notifications/index.html.erb @@ -13,7 +13,7 @@ <%= notification.subject %>
- <%= notification.body.truncate(70) %> + <%= strip_tags(notification.body).truncate(70) %>
<% end %>
diff --git a/app/views/notifications/show.html.erb b/app/views/notifications/show.html.erb index be641f66..1d61ccc3 100644 --- a/app/views/notifications/show.html.erb +++ b/app/views/notifications/show.html.erb @@ -4,7 +4,7 @@

<%= @notification.subject %>

- <%= @notification.body %> + <%= raw @notification.body %>
<%= link_to 'Back', notifications_path %>