profile.rb 1.11 KB
Newer Older
gfyoung's avatar
gfyoung committed
1
2
# frozen_string_literal: true

3
4
module Emails
  module Profile
5
    def new_user_email(user_id, token = nil)
Douwe Maan's avatar
Douwe Maan committed
6
      @current_user = @user = User.find(user_id)
7
      @target_url = user_url(@user)
8
      @token = token
9
      mail(to: @user.notification_email, subject: subject("Account was created for you"))
10
11
    end

12
    # rubocop: disable CodeReuse/ActiveRecord
13
    def new_ssh_key_email(key_id)
14
      @key = Key.find_by(id: key_id)
15
16
17

      return unless @key

Douwe Maan's avatar
Douwe Maan committed
18
      @current_user = @user = @key.user
19
      @target_url = user_url(@user)
20
      mail(to: @user.notification_email, subject: subject("SSH key was added to your account"))
21
    end
22
    # rubocop: enable CodeReuse/ActiveRecord
23

24
    # rubocop: disable CodeReuse/ActiveRecord
25
    def new_gpg_key_email(gpg_key_id)
26
      @gpg_key = GpgKey.find_by(id: gpg_key_id)
27
28
29
30
31
32
33

      return unless @gpg_key

      @current_user = @user = @gpg_key.user
      @target_url = user_url(@user)
      mail(to: @user.notification_email, subject: subject("GPG key was added to your account"))
    end
34
    # rubocop: enable CodeReuse/ActiveRecord
35
36
  end
end
37
38

Emails::Profile.prepend_if_ee('EE::Emails::Profile')