2018-11-20 20:47:30 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2014-09-02 18:07:02 +05:30
|
|
|
module Emails
|
|
|
|
module Projects
|
2015-10-24 18:46:33 +05:30
|
|
|
def project_was_moved_email(project_id, user_id, old_path_with_namespace)
|
2015-04-26 12:48:37 +05:30
|
|
|
@current_user = @user = User.find user_id
|
2014-09-02 18:07:02 +05:30
|
|
|
@project = Project.find project_id
|
2017-09-10 17:25:29 +05:30
|
|
|
@target_url = project_url(@project)
|
2015-10-24 18:46:33 +05:30
|
|
|
@old_path_with_namespace = old_path_with_namespace
|
2019-09-04 21:01:54 +05:30
|
|
|
mail(to: recipient(user_id, @project.group),
|
2014-09-02 18:07:02 +05:30
|
|
|
subject: subject("Project was moved"))
|
|
|
|
end
|
|
|
|
|
2016-06-22 15:30:34 +05:30
|
|
|
def project_was_exported_email(current_user, project)
|
|
|
|
@project = project
|
2019-09-04 21:01:54 +05:30
|
|
|
mail(to: recipient(current_user.id, project.group),
|
2016-06-22 15:30:34 +05:30
|
|
|
subject: subject("Project was exported"))
|
|
|
|
end
|
|
|
|
|
|
|
|
def project_was_not_exported_email(current_user, project, errors)
|
|
|
|
@project = project
|
|
|
|
@errors = errors
|
2019-09-04 21:01:54 +05:30
|
|
|
mail(to: recipient(current_user.id, @project.group),
|
2016-06-22 15:30:34 +05:30
|
|
|
subject: subject("Project export error"))
|
|
|
|
end
|
|
|
|
|
2019-02-15 15:39:39 +05:30
|
|
|
def repository_cleanup_success_email(project, user)
|
|
|
|
@project = project
|
|
|
|
@user = user
|
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
mail(to: recipient(user.id, project.group), subject: subject("Project cleanup has completed"))
|
2019-02-15 15:39:39 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def repository_cleanup_failure_email(project, user, error)
|
|
|
|
@project = project
|
|
|
|
@user = user
|
|
|
|
@error = error
|
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
mail(to: recipient(user.id, project.group), subject: subject("Project cleanup failure"))
|
2019-02-15 15:39:39 +05:30
|
|
|
end
|
|
|
|
|
2016-06-02 11:05:42 +05:30
|
|
|
def repository_push_email(project_id, opts = {})
|
2015-12-23 02:04:40 +05:30
|
|
|
@message =
|
2016-06-02 11:05:42 +05:30
|
|
|
Gitlab::Email::Message::RepositoryPush.new(self, project_id, opts)
|
2015-04-26 12:48:37 +05:30
|
|
|
|
2015-12-23 02:04:40 +05:30
|
|
|
# used in notify layout
|
|
|
|
@target_url = @message.target_url
|
2016-06-02 11:05:42 +05:30
|
|
|
@project = Project.find(project_id)
|
|
|
|
@diff_notes_disabled = true
|
2016-01-29 22:53:50 +05:30
|
|
|
|
|
|
|
add_project_headers
|
|
|
|
headers['X-GitLab-Author'] = @message.author_username
|
2015-12-23 02:04:40 +05:30
|
|
|
|
|
|
|
mail(from: sender(@message.author_id, @message.send_from_committer_email?),
|
|
|
|
reply_to: @message.reply_to,
|
|
|
|
subject: @message.subject)
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|