Commit e90d6ec1 authored by Rémy Coutable's avatar Rémy Coutable

Create a SentNotification record for #relabeled_issue_email / #relabeled_merge_request_email

parent c98089b2
module ToggleSubscriptionAction
extend ActiveSupport::Concern
def toggle_subscription
return unless current_user
subscribable_resource.toggle_subscription(current_user)
render nothing: true
end
private
def subscribable_resource
raise NotImplementedError
end
end
...@@ -21,7 +21,7 @@ module Emails ...@@ -21,7 +21,7 @@ module Emails
end end
def relabeled_issue_email(recipient_id, issue_id, label_names, updated_by_user_id) def relabeled_issue_email(recipient_id, issue_id, label_names, updated_by_user_id)
setup_issue_mail(issue_id, recipient_id, sent_notification: false) setup_issue_mail(issue_id, recipient_id)
@label_names = label_names @label_names = label_names
@labels_url = namespace_project_labels_url(@project.namespace, @project) @labels_url = namespace_project_labels_url(@project.namespace, @project)
...@@ -38,15 +38,13 @@ module Emails ...@@ -38,15 +38,13 @@ module Emails
private private
def setup_issue_mail(issue_id, recipient_id, sent_notification: true) def setup_issue_mail(issue_id, recipient_id)
@issue = Issue.find(issue_id) @issue = Issue.find(issue_id)
@project = @issue.project @project = @issue.project
@target_url = namespace_project_issue_url(@project.namespace, @project, @issue) @target_url = namespace_project_issue_url(@project.namespace, @project, @issue)
if sent_notification
@sent_notification = SentNotification.record(@issue, recipient_id, reply_key) @sent_notification = SentNotification.record(@issue, recipient_id, reply_key)
end end
end
def issue_thread_options(sender_id, recipient_id) def issue_thread_options(sender_id, recipient_id)
{ {
......
...@@ -14,7 +14,7 @@ module Emails ...@@ -14,7 +14,7 @@ module Emails
end end
def relabeled_merge_request_email(recipient_id, merge_request_id, label_names, updated_by_user_id) def relabeled_merge_request_email(recipient_id, merge_request_id, label_names, updated_by_user_id)
setup_merge_request_mail(merge_request_id, recipient_id, sent_notification: false) setup_merge_request_mail(merge_request_id, recipient_id)
@label_names = label_names @label_names = label_names
@labels_url = namespace_project_labels_url(@project.namespace, @project) @labels_url = namespace_project_labels_url(@project.namespace, @project)
...@@ -44,15 +44,13 @@ module Emails ...@@ -44,15 +44,13 @@ module Emails
private private
def setup_merge_request_mail(merge_request_id, recipient_id, sent_notification: true) def setup_merge_request_mail(merge_request_id, recipient_id)
@merge_request = MergeRequest.find(merge_request_id) @merge_request = MergeRequest.find(merge_request_id)
@project = @merge_request.project @project = @merge_request.project
@target_url = namespace_project_merge_request_url(@project.namespace, @project, @merge_request) @target_url = namespace_project_merge_request_url(@project.namespace, @project, @merge_request)
if sent_notification
@sent_notification = SentNotification.record(@merge_request, recipient_id, reply_key) @sent_notification = SentNotification.record(@merge_request, recipient_id, reply_key)
end end
end
def merge_request_thread_options(sender_id, recipient_id) def merge_request_thread_options(sender_id, recipient_id)
{ {
......
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