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