Commit ad2e99ff authored by Lee Tickett's avatar Lee Tickett Committed by Mayra Cabrera

Created alias to map issues `service_desk_reply_to` to `external_author`

parent a10b9c9a
......@@ -47,7 +47,7 @@ module Emails
def service_desk_options(email_sender, email_type)
{
from: email_sender,
to: @issue.service_desk_reply_to
to: @issue.external_author
}.tap do |options|
next unless template_body = template_content(email_type)
......
......@@ -90,6 +90,8 @@ class Issue < ApplicationRecord
alias_attribute :parent_ids, :project_id
alias_method :issuing_parent, :project
alias_attribute :external_author, :service_desk_reply_to
scope :in_projects, ->(project_ids) { where(project_id: project_ids) }
scope :not_in_projects, ->(project_ids) { where.not(project_id: project_ids) }
......
......@@ -353,7 +353,7 @@ class NotificationService
issue = note.noteable
support_bot = User.support_bot
return unless issue.service_desk_reply_to.present?
return unless issue.external_author.present?
return unless issue.project.service_desk_enabled?
return if note.author == support_bot
return unless issue.subscribed?(support_bot, issue.project)
......
---
title: Add `external_author` alias to `service_desk_reply_to`
merge_request: 48363
author: Lee Tickett
type: other
......@@ -78,7 +78,7 @@ module Gitlab
title: issue_title,
description: message_including_template,
confidential: true,
service_desk_reply_to: from_address
external_author: from_address
).execute
raise InvalidIssueError unless @issue.persisted?
......
......@@ -220,6 +220,7 @@ excluded_attributes:
- :duplicated_to_id
- :promoted_to_epic_id
- :blocking_issues_count
- :service_desk_reply_to
merge_request:
- :milestone_id
- :sprint_id
......
......@@ -61,7 +61,7 @@
"lock_version":0,
"time_estimate":0,
"relative_position":1073742323,
"service_desk_reply_to":null,
"external_author":null,
"last_edited_at":null,
"last_edited_by_id":null,
"discussion_locked":null,
......@@ -244,7 +244,7 @@
"lock_version":0,
"time_estimate":0,
"relative_position":1073742823,
"service_desk_reply_to":null,
"external_author":null,
"last_edited_at":null,
"last_edited_by_id":null,
"discussion_locked":null,
......
......@@ -254,7 +254,7 @@ RSpec.describe Gitlab::Email::Handler::ServiceDeskHandler do
new_issue = Issue.last
expect(new_issue.service_desk_reply_to).to eq('finn@adventuretime.ooo')
expect(new_issue.external_author).to eq('finn@adventuretime.ooo')
end
end
......
......@@ -26,7 +26,7 @@ Issue:
- weight
- time_estimate
- relative_position
- service_desk_reply_to
- external_author
- last_edited_at
- last_edited_by_id
- discussion_locked
......
......@@ -1284,7 +1284,7 @@ RSpec.describe Notify do
context 'for service desk issues' do
before do
issue.update!(service_desk_reply_to: 'service.desk@example.com')
issue.update!(external_author: 'service.desk@example.com')
end
def expect_sender(username)
......
......@@ -353,7 +353,7 @@ RSpec.describe NotificationService, :mailer do
context 'a service-desk issue' do
before do
issue.update!(service_desk_reply_to: 'service.desk@example.com')
issue.update!(external_author: 'service.desk@example.com')
project.update!(service_desk_enabled: true)
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