Commit 4855f95f authored by Lee Tickett's avatar Lee Tickett Committed by Kerri Miller

Add service_desk_reply_to to issues list and header

parent 603f057a
......@@ -35,6 +35,7 @@ export default {
i18n: {
openedAgo: __('opened %{timeAgoString} by %{user}'),
openedAgoJira: __('opened %{timeAgoString} by %{user} in Jira'),
openedAgoServiceDesk: __('opened %{timeAgoString} by %{email} via %{user}'),
},
inject: ['scopedLabelsAvailable'],
components: {
......@@ -206,6 +207,11 @@ export default {
healthStatus() {
return convertToCamelCase(this.issuable.health_status);
},
openedMessage() {
if (this.isJiraIssue) return this.$options.i18n.openedAgoJira;
if (this.issuable.service_desk_reply_to) return this.$options.i18n.openedAgoServiceDesk;
return this.$options.i18n.openedAgo;
},
},
mounted() {
// TODO: Refactor user popover to use its own component instead of
......@@ -311,9 +317,7 @@ export default {
<span data-testid="openedByMessage" class="gl-display-none d-sm-inline-block gl-mr-4">
&middot;
<gl-sprintf
:message="isJiraIssue ? $options.i18n.openedAgoJira : $options.i18n.openedAgo"
>
<gl-sprintf :message="openedMessage">
<template #timeAgoString>
<span>{{ issuableCreatedAt }}</span>
</template>
......@@ -326,6 +330,9 @@ export default {
>{{ issuableAuthor.name }}</gl-link
>
</template>
<template #email>
<span>{{ issuable.service_desk_reply_to }}</span>
</template>
</gl-sprintf>
</span>
......
......@@ -189,6 +189,10 @@ module IssuablesHelper
output = []
output << "Opened #{time_ago_with_tooltip(issuable.created_at)} by ".html_safe
if issuable.is_a?(Issue) && issuable.service_desk_reply_to
output << "#{html_escape(issuable.service_desk_reply_to)} via "
end
output << content_tag(:strong) do
author_output = link_to_member(project, issuable.author, size: 24, mobile_classes: "d-none d-sm-inline")
author_output << link_to_member(project, issuable.author, size: 24, by_username: true, avatar: false, mobile_classes: "d-inline d-sm-none")
......
......@@ -22,8 +22,10 @@
#{issuable_reference(issue)}
%span.issuable-authored.d-none.d-sm-inline-block
&middot;
opened #{time_ago_with_tooltip(issue.created_at, placement: 'bottom')}
by #{link_to_member(@project, issue.author, avatar: false)}
opened #{time_ago_with_tooltip(issue.created_at, placement: 'bottom')} by
- if issue.service_desk_reply_to
#{issue.service_desk_reply_to} via
#{link_to_member(@project, issue.author, avatar: false)}
= render_if_exists 'shared/issuable/gitlab_team_member_badge', {author: issue.author}
- if issue.milestone
%span.issuable-milestone.d-none.d-sm-inline-block
......
---
title: Add `service_desk_reply_to` to issues list and header
merge_request: 48089
author: Lee Tickett
type: added
......@@ -678,6 +678,7 @@ Example response:
},
"subscribed": true,
"moved_to_id": null,
"service_desk_reply_to": "service.desk@gitlab.com",
"epic_iid": null,
"epic": null
}
......
......@@ -43,6 +43,7 @@ module API
end
expose :moved_to_id
expose :service_desk_reply_to
end
end
end
......
......@@ -32862,6 +32862,9 @@ msgstr ""
msgid "open issue"
msgstr ""
msgid "opened %{timeAgoString} by %{email} via %{user}"
msgstr ""
msgid "opened %{timeAgoString} by %{user}"
msgstr ""
......
......@@ -4,7 +4,9 @@ require 'spec_helper'
RSpec.describe 'Service Desk Issue Tracker', :js do
let(:project) { create(:project, :private, service_desk_enabled: true) }
let(:user) { create(:user) }
let_it_be(:user) { create(:user) }
let_it_be(:support_bot) { User.support_bot }
before do
# The following two conditions equate to Gitlab::ServiceDesk.supported == true
......@@ -27,6 +29,16 @@ RSpec.describe 'Service Desk Issue Tracker', :js do
end
end
context 'issue page' do
let(:service_desk_issue) { create(:issue, project: project, author: support_bot, service_desk_reply_to: 'service.desk@example.com') }
it 'shows service_desk_reply_to in issue header' do
visit project_issue_path(project, service_desk_issue)
expect(page).to have_text('by service.desk@example.com via GitLab Support Bot')
end
end
describe 'issues list' do
context 'when service desk is supported' do
context 'when there are no issues' do
......@@ -66,10 +78,10 @@ RSpec.describe 'Service Desk Issue Tracker', :js do
end
context 'when there are issues' do
let(:support_bot) { User.support_bot }
let(:other_user) { create(:user) }
let!(:service_desk_issue) { create(:issue, project: project, author: support_bot) }
let!(:other_user_issue) { create(:issue, project: project, author: other_user) }
let_it_be(:project) { create(:project, :private, service_desk_enabled: true) }
let_it_be(:other_user) { create(:user) }
let_it_be(:service_desk_issue) { create(:issue, project: project, author: support_bot, service_desk_reply_to: 'service.desk@example.com') }
let_it_be(:other_user_issue) { create(:issue, project: project, author: other_user) }
describe 'service desk info content' do
before do
......@@ -94,6 +106,10 @@ RSpec.describe 'Service Desk Issue Tracker', :js do
it 'only displays issues created by support bot' do
expect(page).to have_selector('.issues-list .issue', count: 1)
end
it 'shows service_desk_reply_to in issues list' do
expect(page).to have_text('by service.desk@example.com via GitLab Support Bot')
end
end
describe 'search box' do
......
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