Passed
Push — master ( 33ca92...23b088 )
by Ahmad
10:28
created

UserMailer.invite_user_signup()   A

Complexity

Conditions 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
dl 0
loc 9
rs 9.95
c 0
b 0
f 0
1
# frozen_string_literal: true
2
3
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/.
4
#
5
# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below).
6
#
7
# This program is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU Lesser General Public License as published by the Free Software
9
# Foundation; either version 3.0 of the License, or (at your option) any later
10
# version.
11
#
12
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
15
#
16
# You should have received a copy of the GNU Lesser General Public License along
17
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
18
19
class UserMailer < ApplicationMailer
20
  include ApplicationHelper
21
  include ThemingHelper
22
23
  default from: Rails.configuration.smtp_sender
24
25
  def verify_email(user, url, settings)
26
    @settings = settings
27
    @user = user
28
    @url = url
29
    @image = logo_image
30
    @color = user_color
31
    mail(to: @user.email, subject: t('landing.welcome'))
32
  end
33
34
  def password_reset(user, url, settings)
35
    @settings = settings
36
    @user = user
37
    @url = url
38
    @image = logo_image
39
    @color = user_color
40
    mail to: user.email, subject: t('reset_password.subtitle')
41
  end
42
43 View Code Duplication
  def user_promoted(user, role, url, settings)
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
44
    @settings = settings
45
    @url = url
46
    @admin_url = url + "admins"
47
    @image = logo_image
48
    @color = user_color
49
    @role = translated_role_name(role)
50
    @admin_role = role.get_permission("can_manage_users") ||
51
                  role.get_permission("can_manage_rooms_recordings") ||
52
                  role.get_permission("can_edit_site_settings") ||
53
                  role.get_permission("can_edit_roles")
54
    mail to: user.email, subject: t('mailer.user.promoted.subtitle', role: translated_role_name(role))
55
  end
56
57 View Code Duplication
  def user_demoted(user, role, url, settings)
58
    @settings = settings
59
    @url = url
60
    @root_url = url
61
    @image = logo_image
62
    @color = user_color
63
    @role = translated_role_name(role)
64
    mail to: user.email, subject: t('mailer.user.demoted.subtitle', role: translated_role_name(role))
65
  end
66
67
  def invite_email(name, email, url, settings)
68
    @settings = settings
69
    @name = name
70
    @email = email
71
    @url = url
72
    @image = logo_image
73
    @color = user_color
74
    mail to: email, subject: t('mailer.user.invite.subject')
75
  end
76
77
  def approve_user(user, url, settings)
78
    @settings = settings
79
    @user = user
80
    @url = url
81
    @image = logo_image
82
    @color = user_color
83
    mail to: user.email, subject: t('mailer.user.approve.subject')
84
  end
85
86
  def approval_user_signup(user, url, admin_emails, settings)
87
    @settings = settings
88
    @user = user
89
    @url = url
90
    @image = logo_image
91
    @color = user_color
92
93
    mail to: admin_emails, subject: t('mailer.user.approve.signup.subject')
94
  end
95
96
  def invite_user_signup(user, url, admin_emails, settings)
97
    @settings = settings
98
    @user = user
99
    @url = url
100
    @image = logo_image
101
    @color = user_color
102
103
    mail to: admin_emails, subject: t('mailer.user.invite.signup.subject')
104
  end
105
end
106