Commit 2e7f3792 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Add Preview namespace to EE extension so Rails

could find it better?
parent 700e532e
class NotifyPreview < ActionMailer::Preview class NotifyPreview < ActionMailer::Preview
prepend EE::NotifyPreview prepend EE::Preview::NotifyPreview
def note_merge_request_email_for_individual_note def note_merge_request_email_for_individual_note
note_email(:note_merge_request_email) do note_email(:note_merge_request_email) do
......
module EE module EE
module NotifyPreview module Preview
extend ActiveSupport::Concern module NotifyPreview
extend ActiveSupport::Concern
# We need to define the methods on the prepender directly because:
# https://github.com/rails/rails/blob/3faf7485623da55215d6d7f3dcb2eed92c59c699/actionmailer/lib/action_mailer/preview.rb#L73 # We need to define the methods on the prepender directly because:
prepended do # https://github.com/rails/rails/blob/3faf7485623da55215d6d7f3dcb2eed92c59c699/actionmailer/lib/action_mailer/preview.rb#L73
def add_merge_request_approver_email prepended do
Notify.add_merge_request_approver_email(user.id, merge_request.id, user.id).message def add_merge_request_approver_email
end Notify.add_merge_request_approver_email(user.id, merge_request.id, user.id).message
end
def issues_csv_email def issues_csv_email
Notify.issues_csv_email(user, project, '1997,Ford,E350', { truncated: false, rows_expected: 3, rows_written: 3 }).message Notify.issues_csv_email(user, project, '1997,Ford,E350', { truncated: false, rows_expected: 3, rows_written: 3 }).message
end end
def approved_merge_request_email def approved_merge_request_email
Notify.approved_merge_request_email(user.id, merge_request.id, approver.id).message Notify.approved_merge_request_email(user.id, merge_request.id, approver.id).message
end end
def unapproved_merge_request_email def unapproved_merge_request_email
Notify.unapproved_merge_request_email(user.id, merge_request.id, approver.id).message Notify.unapproved_merge_request_email(user.id, merge_request.id, approver.id).message
end end
def mirror_was_hard_failed_email def mirror_was_hard_failed_email
Notify.mirror_was_hard_failed_email(project.id, user.id).message Notify.mirror_was_hard_failed_email(project.id, user.id).message
end end
def project_mirror_user_changed_email def project_mirror_user_changed_email
Notify.project_mirror_user_changed_email(user.id, 'deleted_user_name', project.id).message Notify.project_mirror_user_changed_email(user.id, 'deleted_user_name', project.id).message
end end
def send_admin_notification def send_admin_notification
Notify.send_admin_notification(user.id, 'Email subject from admin', 'Email body from admin').message Notify.send_admin_notification(user.id, 'Email subject from admin', 'Email body from admin').message
end end
def send_unsubscribed_notification def send_unsubscribed_notification
Notify.send_unsubscribed_notification(user.id).message Notify.send_unsubscribed_notification(user.id).message
end end
def service_desk_new_note_email def service_desk_new_note_email
cleanup do cleanup do
note = create_note(noteable_type: 'Issue', noteable_id: issue.id, note: 'Issue note content') note = create_note(noteable_type: 'Issue', noteable_id: issue.id, note: 'Issue note content')
Notify.service_desk_new_note_email(issue.id, note.id).message Notify.service_desk_new_note_email(issue.id, note.id).message
end
end end
end
def service_desk_thank_you_email def service_desk_thank_you_email
Notify.service_desk_thank_you_email(issue.id).message Notify.service_desk_thank_you_email(issue.id).message
end
end end
end
private private
def approver def approver
@user ||= User.first @user ||= User.first
end
end end
end end
end end
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