diff --git a/app/controllers/my_profile/profile_editor_controller.rb b/app/controllers/my_profile/profile_editor_controller.rb index d68f9e5..79c5b99 100644 --- a/app/controllers/my_profile/profile_editor_controller.rb +++ b/app/controllers/my_profile/profile_editor_controller.rb @@ -70,8 +70,13 @@ class ProfileEditorController < MyProfileController def destroy_profile if request.post? + send_mail_list = @profile.admins + profile_name = @profile.name if @profile.destroy session[:notice] = _('The profile was deleted.') + send_mail_list.each do |u| + UserMailer.destroy_organization_mail(u.user,profile_name).deliver + end redirect_to :controller => 'home' else session[:notice] = _('Could not delete profile') diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index 3b91cdb..380b5ca 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -52,6 +52,11 @@ class UserMailer < ActionMailer::Base send_user_mail(user, subject) end + def destroy_organization_mail(user,profile) + @profile = profile + subject = "[%{environment}] Profile Deleted!" % { :environment => user.environment.name } + send_user_mail(user, subject) + end def ban_user_mail(user) subject = "[%{environment}] User Deactivated!" % { :environment => user.environment.name } send_user_mail(user, subject) diff --git a/app/views/admin_panel/_organization_search.html.erb b/app/views/admin_panel/_organization_search.html.erb index ea5c1b4..4af20d9 100644 --- a/app/views/admin_panel/_organization_search.html.erb +++ b/app/views/admin_panel/_organization_search.html.erb @@ -1,7 +1,8 @@ -