Commit 63bacd34 authored by Małgorzata Ksionek's avatar Małgorzata Ksionek

Add working email mechanism

Add txt email template

Add some changes to text template

Fix available for welcome email method
parent 48619ab0
...@@ -31,6 +31,6 @@ class DeviseMailerPreview < ActionMailer::Preview ...@@ -31,6 +31,6 @@ class DeviseMailerPreview < ActionMailer::Preview
private private
def unsaved_user def unsaved_user
User.new(name: 'Jane Doe', email: 'jdoe@example.com') User.new(name: 'Jane Doe', email: 'jdoe@example.com', created_at: 1.minute.ago)
end end
end end
...@@ -62,7 +62,7 @@ class GroupMember < Member ...@@ -62,7 +62,7 @@ class GroupMember < Member
end end
def post_create_hook def post_create_hook
if available_for_welcome_email if available_for_welcome_email?
run_after_commit_or_now { notification_service.new_group_member(self) } run_after_commit_or_now { notification_service.new_group_member(self) }
end end
...@@ -90,7 +90,7 @@ class GroupMember < Member ...@@ -90,7 +90,7 @@ class GroupMember < Member
super super
end end
def available_for_welcome_email def available_for_welcome_email?
true true
end end
end end
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
%p %p
= _('An Enterprise User GitLab account has been created for you by your organization:') = _('An Enterprise User GitLab account has been created for you by your organization:')
%p %p
= _('Username: %{username}' % { username: @user.username } = _('Username: %{username}') % { username: @user.username }
%br %br
= _('Email: %{email}') % { email: @user.email } = _('Email: %{email}') % { email: @user.email }
%br %br
...@@ -15,10 +15,10 @@ ...@@ -15,10 +15,10 @@
%tr %tr
%td.text-content %td.text-content
%p %p
= _('By authenticating with an account tied to an Enterprise e-mail address, it is understood that this account is an = _('By authenticating with an account tied to an Enterprise e-mail address, it is understood that this account is an Enterprise User. ')
Enterprise User. To ensure no loss of personal content, an Individual User should create a separate account under = _('To ensure no loss of personal content, an Individual User should create a separate account under their own personal email address, not tied to the Enterprise email domain or name-space.')
their own personal email address, not tied to the Enterprise email domain or name-space.') - unless @user.confirmed?
%p %p
= _('To get started, click the link below to confirm your account.') = _('To get started, click the link below to confirm your account.')
%p %p
= link_to 'Confirm your account', confirmation_link = link_to 'Confirm your account', confirmation_link
<% source_type = member_source.model_name.singular %> <% source_link = member_source.web_url %>
<%= _('You have been granted %{access_level} access to the %{source_name} %{source_type}.') % { access_level: member.human_access, source_name: member_source.human_name, source_type: source_type } %>
<%= member_source.web_url %> <%= _('An Enterprise User GitLab account has been created for you by your organization:') %>
<%= _('Username: %{username}') % { username: @user.username } %>
<%= _('Email: %{email}') % { email: @user.email } %>
<%= _('GitLab group: %{source_link}').html_safe % { source_link: source_link } %>
<%= _('If this was a mistake you can leave the %{source_type}.') % { source_type: source_type } %>
<%= polymorphic_url([member_source], leave: 1) %> <%= _('By authenticating with an account tied to an Enterprise e-mail address, it is understood that this account is an Enterprise User. ') %>
<%= _('To ensure no loss of personal content, an Individual User should create a separate account under their own personal email address, not tied to the Enterprise email domain or name-space.') %>
<%= _('To get started, click the link below to confirm your account.') %>
<%= confirmation_url(@user, confirmation_token: @user.confirmation_token) %>
...@@ -5,6 +5,7 @@ Rails.application.configure do ...@@ -5,6 +5,7 @@ Rails.application.configure do
# every request. This slows down response time but is perfect for development # every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes. # since you don't have to restart the web server when you make code changes.
config.cache_classes = Gitlab::Utils.to_boolean(ENV['CACHE_CLASSES'], default: false) config.cache_classes = Gitlab::Utils.to_boolean(ENV['CACHE_CLASSES'], default: false)
config.hosts << "gdk.test"
# Show full error reports and disable caching # Show full error reports and disable caching
config.active_record.verbose_query_logs = true config.active_record.verbose_query_logs = true
......
...@@ -52,7 +52,7 @@ module EE ...@@ -52,7 +52,7 @@ module EE
end end
def new_group_member_with_confirmation_email def new_group_member_with_confirmation_email
Notify.member_access_granted_email_with_confirmation(member.source_type, member.id).message ::Notify.member_access_granted_email_with_confirmation(member.source_type, member.id).message
end end
end end
......
...@@ -143,9 +143,9 @@ module EE ...@@ -143,9 +143,9 @@ module EE
end end
end end
override :available_for_welcome_email override :available_for_welcome_email?
def available_for_welcome_email def available_for_welcome_email?
provisioned_by_this_group? !provisioned_by_this_group?
end end
def provisioned_by_this_group? def provisioned_by_this_group?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment