From cccabcdd7b1905b721c169a49c4198be1c8bf186 Mon Sep 17 00:00:00 2001 From: Luka Murn Date: Wed, 12 Oct 2016 10:44:03 +0200 Subject: [PATCH] Remove invitation_to_organization email This email is no longer needed, because if user enables assignment notifications, he/she will already receive an email whenever he/she is added to a new organization/team (via notifications email). --- app/controllers/users/settings_controller.rb | 3 --- app/mailers/app_mailer.rb | 8 ------- .../invitation_to_organization.html.erb | 1 - config/locales/en.yml | 5 ----- test/mailers/previews/app_mailer_preview.rb | 21 ------------------- 5 files changed, 38 deletions(-) delete mode 100644 app/views/users/mailer/invitation_to_organization.html.erb diff --git a/app/controllers/users/settings_controller.rb b/app/controllers/users/settings_controller.rb index 7e8f13c3c..3f8b93f8d 100644 --- a/app/controllers/users/settings_controller.rb +++ b/app/controllers/users/settings_controller.rb @@ -212,9 +212,6 @@ class Users::SettingsController < ApplicationController user: @new_user_org.user, organization: @new_user_org.organization ).exists? && @new_user_org.save - AppMailer.delay.invitation_to_organization(@new_user_org.user, - @user_organization.user, - @new_user_org.organization) generate_notification(@user_organization.user, @new_user_org.user, diff --git a/app/mailers/app_mailer.rb b/app/mailers/app_mailer.rb index d72873ea2..56a8e5a3e 100644 --- a/app/mailers/app_mailer.rb +++ b/app/mailers/app_mailer.rb @@ -5,14 +5,6 @@ class AppMailer < Devise::Mailer default from: ENV["MAIL_FROM"] default reply: ENV["MAIL_REPLYTO"] - def invitation_to_organization(user, added_by, organization, opts = {}) - @user = user - @added_by = added_by - @org = organization - headers = { to: @user.email, subject: (I18n.t('mailer.invitation_to_organization.subject')) }.merge(opts) - mail(headers) - end - def notification(user, notification) @user = user @notification = notification diff --git a/app/views/users/mailer/invitation_to_organization.html.erb b/app/views/users/mailer/invitation_to_organization.html.erb deleted file mode 100644 index cf9eca43f..000000000 --- a/app/views/users/mailer/invitation_to_organization.html.erb +++ /dev/null @@ -1 +0,0 @@ -

<%=t "mailer.invitation_to_organization.text", addedBy: @added_by.name, organization: @org.name %>

\ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index 411592bcf..8d2572a1b 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1449,11 +1449,6 @@ en: head_title: "Edit protocol" no_keywords: "No keywords" - mailer: - invitation_to_organization: - subject: "You have been invited to team" - text: "User %{addedBy} has added you to team %{organization}." - time: formats: full: "%d.%m.%Y %H:%M" diff --git a/test/mailers/previews/app_mailer_preview.rb b/test/mailers/previews/app_mailer_preview.rb index 5d339b622..8bb5e72b4 100644 --- a/test/mailers/previews/app_mailer_preview.rb +++ b/test/mailers/previews/app_mailer_preview.rb @@ -15,10 +15,6 @@ class AppMailerPreview < ActionMailer::Preview AppMailer.invitation_instructions(fake_user, "faketoken", {}) end - def invitation_to_organization - AppMailer.invitation_to_organization(fake_user, fake_user_2, fake_org, {}) - end - private def fake_user @@ -31,21 +27,4 @@ class AppMailerPreview < ActionMailer::Preview confirmed_at: Time.now ) end - - def fake_user_2 - User.new( - full_name: "Bob Dylan", - initials: "BD", - email: "bob.dylan@gmail.com", - created_at: Time.now, - updated_at: Time.now, - confirmed_at: Time.now - ) - end - - def fake_org - Organization.new( - name: "Greatest musicians of all time" - ) - end end \ No newline at end of file