polish mailboxer with bug fixes

This commit is contained in:
Devin Howard 2016-12-09 11:55:53 -05:00
parent 3f6f020ce1
commit 88e98c7342
7 changed files with 19 additions and 14 deletions

View file

@ -625,7 +625,7 @@
.sidebarForkIcon div:after, .sidebarForkIcon div:after,
.sidebarFilterIcon div:after, .sidebarFilterIcon div:after,
.notificationsIcon div:after, .notificationsIcon div:after,
.sidebarAccountIcon .tooltipsUnder:after, .sidebarAccountIcon .tooltipsUnder:after {
content: ''; content: '';
position: absolute; position: absolute;
right: 40%; right: 40%;

View file

@ -36,8 +36,9 @@ class AccessController < ApplicationController
@map.add_new_collaborators(user_ids).each do |user_id| @map.add_new_collaborators(user_ids).each do |user_id|
# add_new_collaborators returns array of added users, # add_new_collaborators returns array of added users,
# who we then send an email to # who we then send an email to
mail = MapMailer.invite_to_edit_email(@map, current_user, User.find(user_id)) user = User.find(user_id)
user.notify(mail.subject, 'invite to edit', UserMap.find_by(user_id: user_id, map: @map), true, MAILBOXER_CODE_INVITED_TO_EDIT) mail = MapMailer.invite_to_edit_email(@map, current_user, user)
user.notify(mail.subject, 'invite to edit', UserMap.find_by(user: user, map: @map), true, MAILBOXER_CODE_INVITED_TO_EDIT)
end end
@map.remove_old_collaborators(user_ids) @map.remove_old_collaborators(user_ids)

View file

@ -11,9 +11,9 @@ class AccessRequest < ApplicationRecord
Mailboxer::Receipt.where(notification: notification).update_all(is_read: true) Mailboxer::Receipt.where(notification: notification).update_all(is_read: true)
end end
UserMap.create(user: user, map: map) user_map = UserMap.create(user: user, map: map)
mail = MapMailer.invite_to_edit_email(map, map.user, user) mail = MapMailer.invite_to_edit_email(map, map.user, user)
user.notify(mail.subject, 'invite to edit', self, true, MAILBOXER_CODE_INVITED_TO_EDIT) user.notify(mail.subject, 'invite to edit', user_map, true, MAILBOXER_CODE_INVITED_TO_EDIT)
end end
def deny def deny

View file

@ -1,4 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<% mail = ApplicationMailer.mail_for_notification(@notification) %> <% mail = ApplicationMailer.mail_for_notification(@notification) %>
<% @notification.update(body: mail.html_part&.body&.decoded) %> <% if mail %>
<%= raw mail.html_part&.body&.decoded %> <% @notification.update(body: mail.html_part&.body&.decoded) %>
<%= raw mail.html_part&.body&.decoded %>
<% end %>

View file

@ -1,2 +1,4 @@
<% mail = ApplicationMailer.mail_for_notification(@notification) %> <% mail = ApplicationMailer.mail_for_notification(@notification) %>
<%= mail.text_part&.body&.decoded %> <% if mail %>
<%= mail.text_part&.body&.decoded %>
<% end %>

View file

@ -1,16 +1,16 @@
# frozen_string_literal: true # frozen_string_literal: true
Rails.application.configure do Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb # Settings specified here will take precedence over those in config/application.rb
config.log_level = :warn # log to stdout
config.eager_load = true logger = Logger.new(STDOUT)
# 12 factor: log to stdout
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter logger.formatter = config.log_formatter
logger.level = :warn
config.logger = ActiveSupport::TaggedLogging.new(logger) config.logger = ActiveSupport::TaggedLogging.new(logger)
# Code is not reloaded between requests # Code is not reloaded between requests
config.eager_load = true
config.cache_classes = true config.cache_classes = true
# Full error reports are disabled and caching is turned on # Full error reports are disabled and caching is turned on

View file

@ -15,7 +15,7 @@ Mailboxer.setup do |config|
config.uses_emails = true config.uses_emails = true
# Configures the default from for emails sent for Messages and Notifications # Configures the default from for emails sent for Messages and Notifications
config.default_from = 'no-reply@metamaps.cc' config.default_from = 'team@metamaps.cc'
# Configures the methods needed by mailboxer # Configures the methods needed by mailboxer
config.email_method = :mailboxer_email config.email_method = :mailboxer_email