Commit 68939589 authored by Jan Provaznik's avatar Jan Provaznik

Merge branch '14755-clarify-why-service-desk-feature-is-unavailable' into 'master'

Resolve "Clarify why Service Desk feature is unavailable"

See merge request gitlab-org/gitlab!19244
parents 45cec190 f762a4ee
......@@ -6,24 +6,34 @@
- can_edit_project_settings = can?(current_user, :admin_project, @project)
- title_text = _("Use Service Desk to connect with your users (e.g. to offer customer support) through email right inside GitLab")
%div{ class: "#{callout_selector}" }
.svg-content
= render svg_path
- if ::EE::Gitlab::ServiceDesk.supported?
%div{ class: "#{callout_selector}" }
.svg-content
= render svg_path
%div{ class: is_empty_state ? "text-content" : "prepend-top-10 prepend-left-default" }
- if is_empty_state
%h4= title_text
- else
%h5= title_text
%div{ class: is_empty_state ? "text-content" : "prepend-top-10 prepend-left-default" }
- if is_empty_state
%h4= title_text
- else
%h5= title_text
- if can_edit_project_settings && service_desk_enabled
%p
= _("Have your users email")
%code= @project.service_desk_address
- if can_edit_project_settings && service_desk_enabled
%p
= _("Have your users email")
%code= @project.service_desk_address
%span= _("Those emails automatically become issues (with the comments becoming the email conversation) listed here.")
= link_to _('Read more'), help_page_path('user/project/service_desk')
%span= _("Those emails automatically become issues (with the comments becoming the email conversation) listed here.")
= link_to _('Read more'), help_page_path('user/project/service_desk')
- if can_edit_project_settings && !service_desk_enabled
%div{ class: is_empty_state ? "text-center" : "prepend-top-10" }
= link_to _("Turn on Service Desk"), edit_project_path(@project), class: 'btn btn-success'
- if can_edit_project_settings && !service_desk_enabled
%div{ class: is_empty_state ? "text-center" : "prepend-top-10" }
= link_to _("Turn on Service Desk"), edit_project_path(@project), class: 'btn btn-success'
- else
.empty-state
.svg-content
= render 'shared/empty_states/icons/service_desk_setup.svg'
.text-content
%h4= _('Service Desk is enabled but not yet active')
%p
= _("You must set up incoming email before it becomes active.")
= link_to _('More information'), help_page_path('administration/incoming_email', anchor: 'set-it-up')
......@@ -12,9 +12,9 @@
= render 'shared/issuable/nav', type: :issues
.nav-controls.d-block.d-sm-none
= render "projects/issues/nav_btns", show_feed_buttons: false, show_import_button: false, show_export_button: false
= render 'shared/issuable/search_bar', type: :issues
- if @issues.present?
= render 'shared/issuable/search_bar', type: :issues
= render 'service_desk_info_content'
.issues-holder
......
- return unless EE::Gitlab::ServiceDesk.enabled?(project: @project)
- return unless EE::Gitlab::ServiceDesk.available?(project: @project)
= nav_link(controller: :issues, action: :service_desk ) do
= link_to service_desk_project_issues_path(@project), title: 'Service Desk' do
......
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="430" height="167" viewBox="0 0 430 167">
<defs>
<rect id="a" width="81" height="4" x="96" y="88"/>
</defs>
<g fill="none" fill-rule="evenodd">
<g transform="translate(282 2)">
<rect width="40" height="4" x="25" y="86" fill="#DFDFDF" rx="2"/>
<rect width="22" height="4" y="86" fill="#DFDFDF" rx="2"/>
<path stroke="#DFDFDF" stroke-linecap="round" stroke-width="4" d="M63,88 C87.300529,88 107,68.300529 107,44 C107,19.699471 87.300529,0 63,0 C38.699471,0 19,19.699471 19,44 C19,55.4692579 23.3882741,65.9135795 30.5774088,73.7455512"/>
<path stroke="#DFDFDF" stroke-linecap="round" stroke-width="4" d="M52,142 L119,142 C133.911688,142 146,129.911688 146,115 C146,100.088312 133.911688,88 119,88 C104.088312,88 92,100.088312 92,115 C92,122.037954 94.6928046,128.446969 99.104319,133.252952" transform="matrix(1 0 0 -1 0 230)"/>
<path fill="#A7A7A7" d="M128 106C129.6569 106 131 107.343145 131 109L131 121C131 122.6569 129.6569 124 128 124L114.06641 124 109.250585 126.78325C108.250579 127.3612 107 126.63955 107 125.48455L107 109C107 107.343145 108.343147 106 110 106L128 106zM128 109L110 109 110 122.8852 113.26184 121 128 121 128 109zM114.5 113.5C115.32842 113.5 116 114.17158 116 115 116 115.82842 115.32842 116.5 114.5 116.5 113.67158 116.5 113 115.82842 113 115 113 114.17158 113.67158 113.5 114.5 113.5zM119 113.5C119.82842 113.5 120.5 114.17158 120.5 115 120.5 115.82842 119.82842 116.5 119 116.5 118.17158 116.5 117.5 115.82842 117.5 115 117.5 114.17158 118.17158 113.5 119 113.5zM123.5 113.5C124.32845 113.5 125 114.17158 125 115 125 115.82842 124.32845 116.5 123.5 116.5 122.67155 116.5 122 115.82842 122 115 122 114.17158 122.67155 113.5 123.5 113.5zM47 36C47 33.790862 48.790862 32 51 32L75 32C77.2092 32 79 33.790862 79 36L79 52C79 54.2092 77.2092 56 75 56L51 56C48.790862 56 47 54.2092 47 52L47 36zM51 36L75 36 75 36.0154 63.0079 42.93904 51 36.0063 51 36zM51 40.6251L51 52 75 52 75 40.6342 63.0079 47.55786 51 40.6251z"/>
</g>
<path stroke="#C2B7E6" stroke-linecap="round" stroke-width="4" d="M276.5,20 L276.5,165"/>
<use fill="#6E49CB" xlink:href="#a"/>
<use fill="#FFFFFF" fill-opacity=".6" xlink:href="#a"/>
<g transform="translate(172 40)">
<path fill="#6E49CB" fill-rule="nonzero" d="M64.5083266,2.16939521 C64.5598976,1.31008332 65.1555623,0.580183202 65.9870892,0.357376239 L67.0659897,0.0682857185 C67.8975166,-0.154521245 68.7783275,0.179758436 69.2526452,0.898158883 L71.0838835,3.67168101 C71.8604055,3.69835108 72.6253745,3.80075177 73.3696161,3.97339039 L75.8570965,1.76768551 C76.501214,1.19651341 77.4383928,1.10164098 78.1839968,1.53205032 L79.1513003,2.09052325 C79.8969043,2.52093259 80.2832521,3.38015574 80.1106561,4.22354464 L79.4443144,7.48050479 C79.9657604,8.03872555 80.4370489,8.65007844 80.8482561,9.30920953 L84.1658391,9.50834112 C85.025263,9.55988206 85.7551052,10.1555623 85.9779122,10.9870892 L86.2670027,12.0659897 C86.4898096,12.8975166 86.1555879,13.778312 85.4370754,14.2526597 L82.6635301,16.0839042 C82.6369953,16.86039 82.534498,17.6253848 82.3620332,18.3695798 L84.5676029,20.8570965 C85.1387232,21.5010208 85.2337633,22.4383618 84.8032767,23.1839864 L84.2448038,24.1512899 C83.8142654,24.8967214 82.9552293,25.2832262 82.111821,25.1106354 L78.8547318,24.4441212 C78.2965242,24.9657707 77.6852679,25.4370334 77.0260789,25.8482561 L76.8269473,29.1658391 C76.7754063,30.025263 76.1797261,30.7551052 75.3481992,30.9779122 L74.2692987,31.2670027 C73.4377718,31.4898096 72.5569764,31.1555879 72.0826287,30.4370754 L70.2513842,27.6635301 C69.4749563,27.6369798 68.7098843,27.5345032 67.9657472,27.3620229 L65.478263,29.5677909 C64.8341648,30.1389578 63.89683,30.2337892 63.1512826,29.8032819 L62.1839598,29.2448141 C61.4384642,28.8145 61.0520043,27.9552448 61.2245757,27.1118417 L61.8910899,23.8547525 C61.369479,23.2965346 60.898313,22.6852524 60.486955,22.0260996 L57.1693952,21.8269618 C56.3100833,21.7753908 55.5801832,21.1797261 55.3573762,20.3481992 L55.0682857,19.2692987 C54.8454788,18.4377718 55.1797584,17.5569609 55.8981589,17.0826432 L58.671681,15.2514049 C58.6983614,14.4749215 58.8007311,13.7098367 58.9733555,12.9656196 L56.7676172,10.4781688 C56.1964503,9.83407059 56.1015416,8.89675656 56.5319717,8.15122986 L57.0904394,7.18390704 C57.5208695,6.43838035 58.380086,6.05193078 59.2234504,6.22451259 L62.4805641,6.89104094 C63.0387487,6.36945971 63.6501081,5.89827293 64.3091888,5.48695498 L64.5083266,2.16939521 Z M72.7381966,23.3950508 C77.00585,22.2515365 79.5385651,17.8647453 78.3950508,13.5970918 C77.2515158,9.32936108 72.8647453,6.79672328 68.5970918,7.94023759 C64.3293611,9.0837726 61.7967026,13.4704658 62.9402376,17.7381966 C64.0837519,22.00585 68.4704658,24.5385858 72.7381966,23.3950508 Z"/>
<path fill="#EFEDF8" stroke="#6E49CB" stroke-width="4" d="M27.08832,20.735088 C27.63276,19.10172 29.16132,18 30.88304,18 L33.11696,18 C34.83868,18 36.36724,19.10172 36.91168,20.735088 L39.01368,27.04104 C40.5,27.49452 41.9248,28.08832 43.2732,28.80708 L49.2204,25.8336 C50.7604,25.0636 52.62,25.36544 53.8376,26.58288 L55.4172,28.16248 C56.6348,29.37992 56.9364,31.2398 56.1664,32.77976 L53.1932,38.7268 C53.9116,40.07512 54.5056,41.50012 54.9588,42.98632 L61.2648,45.08832 C62.8984,45.63276 64,47.16132 64,48.88304 L64,51.11696 C64,52.83868 62.8984,54.36724 61.2648,54.91168 L54.9588,57.01368 C54.5056,58.5 53.9116,59.9248 53.1932,61.2732 L56.1664,67.2204 C56.9364,68.76 56.6348,70.62 55.4172,71.8376 L53.8376,73.4172 C52.62,74.6344 50.7604,74.9364 49.2204,74.1664 L43.2732,71.1928 C41.9248,71.9116 40.5,72.5056 39.01368,72.9588 L36.91168,79.2648 C36.36724,80.8984 34.83868,82 33.11696,82 L30.88304,82 C29.16132,82 27.63276,80.8984 27.08832,79.2648 L24.98632,72.9588 C23.50012,72.5056 22.07516,71.9116 20.72688,71.1932 L14.77964,74.1668 C13.23968,74.9368 11.3798,74.6348 10.16236,73.4172 L8.58272,71.8376 C7.36528,70.6204 7.06348,68.7604 7.83344,67.2204 L10.80704,61.2732 C10.08832,59.9248 9.49452,58.5 9.04104,57.01368 L2.735088,54.91168 C1.10172,54.36724 0,52.83868 0,51.11696 L0,48.88304 C0,47.16132 1.10172,45.63276 2.735088,45.08832 L9.04104,42.98632 C9.49452,41.50008 10.08832,40.07504 10.80704,38.72668 L7.83348,32.77952 C7.06348,31.23956 7.36532,29.37968 8.58276,28.16224 L10.16236,26.5826 C11.3798,25.36516 13.23972,25.06336 14.77964,25.83332 L20.72688,28.80696 C22.0752,28.08828 23.50016,27.49448 24.98632,27.04104 L27.08832,20.735088 Z M32,66 C40.8364,66 48,58.8364 48,50 C48,41.16344 40.8364,34 32,34 C23.16344,34 16,41.16344 16,50 C16,58.8364 23.16344,66 32,66 Z"/>
<circle cx="32" cy="50" r="10" stroke="#6E49CB" stroke-linecap="round" stroke-width="2"/>
</g>
<g stroke="#FC6D26" transform="translate(123 78)">
<circle cx="12" cy="12" r="11" fill="#FFFFFF" stroke-width="2"/>
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M8,12.25 C9.8974359,14.0833333 10.8461538,15 10.8461538,15 C10.8461538,15 12.8974359,13 17,9"/>
</g>
<g transform="translate(0 40)">
<circle cx="50" cy="50" r="48" fill="#FFFFFF" stroke="#FC6D26" stroke-width="4"/>
<circle cx="21" cy="50" r="4" fill="#6E49CB"/>
<circle cx="79" cy="50" r="4" fill="#6E49CB"/>
<circle cx="50" cy="50" r="27" fill="#FFFFFF" stroke="#E1DBF1" stroke-width="4"/>
<rect width="38" height="24" x="31" y="38" fill="#FFFFFF" stroke="#E1DBF1" stroke-width="2" rx="12"/>
<circle cx="50" cy="69" r="2" fill="#6E49CB"/>
<circle cx="50" cy="69" r="2" fill="#6E49CB"/>
<circle cx="55" cy="69" r="1" fill="#6E49CB"/>
<circle cx="45" cy="69" r="1" fill="#6E49CB"/>
<path stroke="#6E49CB" stroke-linecap="round" stroke-width="2" d="M48 30L52 30M15 50L19 50M81 50L85 50M48 33.5L52 33.5"/>
<path fill="#6E49CB" d="M54.214 52.70154C54.9314 53.11584 55.177 54.0332 54.7628 54.7506 54.2804 55.5856 53.58722 56.2792 52.7524 56.7618 51.91758 57.2442 50.97058 57.4988 50.00632 57.5000085 49.04208 57.5012 48.09448 57.2488 47.25856 56.768 46.42264 56.2874 45.72774 55.5956 45.24358 54.7616 44.8276 54.0452 45.07118 53.12726 45.7876 52.71128 46.4443183 52.3299833 47.2704031 52.5028667 47.7239338 53.0861543L47.83798 53.2553C48.05804 53.63434 48.3739 53.94886 48.75388 54.1674 49.13384 54.3858 49.56456 54.5006 50.00286 54.5 50.44116 54.4994 50.8716 54.3838 51.25108 54.1644 51.554648 53.988944 51.8170384 53.7520992 52.0220822 53.470055L52.16486 53.2503C52.57918 52.53292 53.49658 52.28722 54.214 52.70154zM41 46C42.10456 46 43 46.89544 43 48 43 49.10456 42.10456 50 41 50 39.89544 50 39 49.10456 39 48 39 46.89544 39.89544 46 41 46zM59 46C60.1046 46 61 46.89544 61 48 61 49.10456 60.1046 50 59 50 57.89544 50 57 49.10456 57 48 57 46.89544 57.89544 46 59 46z"/>
</g>
</g>
</svg>
---
title: Clarify why Service Desk feature is unavailable
merge_request: 19244
author:
type: fixed
......@@ -7,8 +7,14 @@ module EE
# feature. Use `project.service_desk_enabled?` to check whether it is
# enabled for a particular project.
def self.enabled?(project: nil)
return unless ::Gitlab::IncomingEmail.enabled? && ::Gitlab::IncomingEmail.supports_wildcard?
supported? && available?(project: project)
end
def self.supported?
::Gitlab::IncomingEmail.enabled? && ::Gitlab::IncomingEmail.supports_wildcard?
end
def self.available?(project: nil)
(project || ::License).feature_available?(:service_desk)
end
end
......
......@@ -8,9 +8,9 @@ describe 'Service Desk Issue Tracker', :js do
before do
allow(License).to receive(:feature_available?).and_call_original
allow(License).to receive(:feature_available?).with(:service_desk) { true }
allow(Gitlab::IncomingEmail).to receive(:enabled?) { true }
allow(Gitlab::IncomingEmail).to receive(:supports_wildcard?) { true }
allow(License).to receive(:feature_available?).with(:service_desk).and_return(true)
allow(Gitlab::IncomingEmail).to receive(:enabled?).and_return(true)
allow(Gitlab::IncomingEmail).to receive(:supports_wildcard?).and_return(true)
project.add_maintainer(user)
sign_in(user)
......@@ -29,6 +29,20 @@ describe 'Service Desk Issue Tracker', :js do
end
describe 'issues list' do
context 'when service desk is misconfigured' do
before do
allow(EE::Gitlab::ServiceDesk).to receive(:supported?).and_return(false)
visit service_desk_project_issues_path(project)
end
it 'shows a message to say the configuration is incomplete' do
expect(page).to have_css('.empty-state')
expect(page).to have_text('Service Desk is enabled but not yet active')
expect(page).to have_text('You must set up incoming email before it becomes active')
expect(page).to have_link('More information', href: help_page_path('administration/incoming_email', anchor: 'set-it-up'))
end
end
context 'when service desk has not been activated' do
let(:project_without_service_desk) { create(:project, :private, service_desk_enabled: false) }
......
......@@ -5,35 +5,65 @@ require 'spec_helper'
describe EE::Gitlab::ServiceDesk do
before do
stub_licensed_features(service_desk: true)
allow(::Gitlab::IncomingEmail).to receive(:enabled?) { true }
allow(::Gitlab::IncomingEmail).to receive(:supports_wildcard?) { true }
allow(::Gitlab::IncomingEmail).to receive(:enabled?).and_return(true)
allow(::Gitlab::IncomingEmail).to receive(:supports_wildcard?).and_return(true)
end
subject { described_class.enabled? }
describe 'enabled?' do
subject { described_class.enabled? }
it { is_expected.to be_truthy }
it { is_expected.to be_truthy }
context 'when license does not support service desk' do
before do
stub_licensed_features(service_desk: false)
context 'when service desk is not available' do
before do
allow(described_class).to receive(:available?).and_return(false)
end
it { is_expected.to be_falsy }
end
it { is_expected.to be_falsy }
context 'when service desk is not supported' do
before do
allow(described_class).to receive(:supported?).and_return(false)
end
it { is_expected.to be_falsy }
end
end
context 'when incoming emails are disabled' do
before do
allow(::Gitlab::IncomingEmail).to receive(:enabled?) { false }
describe 'supported?' do
subject { described_class.supported? }
it { is_expected.to be_truthy }
context 'when incoming emails are disabled' do
before do
allow(::Gitlab::IncomingEmail).to receive(:enabled?).and_return(false)
end
it { is_expected.to be_falsy }
end
it { is_expected.to be_falsy }
end
context 'when email key is not supported' do
before do
allow(::Gitlab::IncomingEmail).to receive(:supports_wildcard?).and_return(false)
end
context 'when email key is not supported' do
before do
allow(::Gitlab::IncomingEmail).to receive(:supports_wildcard?) { false }
it { is_expected.to be_falsy }
end
end
describe 'available?' do
subject { described_class.available? }
it { is_expected.to be_falsy }
it { is_expected.to be_truthy }
context 'when license does not support service desk' do
before do
stub_licensed_features(service_desk: false)
end
it { is_expected.to be_falsy }
end
end
end
......@@ -15546,6 +15546,9 @@ msgstr ""
msgid "Service Desk"
msgstr ""
msgid "Service Desk is enabled but not yet active"
msgstr ""
msgid "Service Templates"
msgstr ""
......@@ -19941,6 +19944,9 @@ msgstr ""
msgid "You must select a stack for configuring your cloud provider. Learn more about"
msgstr ""
msgid "You must set up incoming email before it becomes active."
msgstr ""
msgid "You need a different license to enable FileLocks feature"
msgstr ""
......
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