Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
5f9eba6c
Commit
5f9eba6c
authored
Apr 20, 2017
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check if incoming emails and email key are available for service desk
parent
0997a5ae
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
57 additions
and
3 deletions
+57
-3
app/models/ee/project.rb
app/models/ee/project.rb
+3
-2
changelogs/unreleased-ee/issue_2160.yml
changelogs/unreleased-ee/issue_2160.yml
+4
-0
lib/ee/gitlab/service_desk.rb
lib/ee/gitlab/service_desk.rb
+4
-1
spec/controllers/projects/service_desk_controller_spec.rb
spec/controllers/projects/service_desk_controller_spec.rb
+2
-0
spec/features/projects/settings/ee/service_desk_setting_spec.rb
...eatures/projects/settings/ee/service_desk_setting_spec.rb
+2
-0
spec/lib/ee/gitlab/service_desk_spec.rb
spec/lib/ee/gitlab/service_desk_spec.rb
+38
-0
spec/lib/gitlab/email/handler/service_desk_handler_spec.rb
spec/lib/gitlab/email/handler/service_desk_handler_spec.rb
+2
-0
spec/services/ee/notification_service_spec.rb
spec/services/ee/notification_service_spec.rb
+2
-0
No files found.
app/models/ee/project.rb
View file @
5f9eba6c
...
@@ -36,8 +36,9 @@ module EE
...
@@ -36,8 +36,9 @@ module EE
private
private
def
service_desk_available?
def
service_desk_available?
@service_desk_available
||=
return
@service_desk_available
if
defined?
(
@service_desk_available
)
EE
::
Gitlab
::
ServiceDesk
.
enabled?
&&
service_desk_enabled?
@service_desk_available
=
EE
::
Gitlab
::
ServiceDesk
.
enabled?
&&
service_desk_enabled?
end
end
end
end
end
end
changelogs/unreleased-ee/issue_2160.yml
0 → 100644
View file @
5f9eba6c
---
title
:
Check if incoming emails and email key are available for service desk
merge_request
:
author
:
lib/ee/gitlab/service_desk.rb
View file @
5f9eba6c
...
@@ -2,7 +2,10 @@ module EE
...
@@ -2,7 +2,10 @@ module EE
module
Gitlab
module
Gitlab
module
ServiceDesk
module
ServiceDesk
def
self
.
enabled?
def
self
.
enabled?
::
License
.
current
&&
::
License
.
current
.
add_on?
(
'GitLab_ServiceDesk'
)
::
License
.
current
&&
::
License
.
current
.
add_on?
(
'GitLab_ServiceDesk'
)
&&
::
Gitlab
::
IncomingEmail
.
enabled?
&&
::
Gitlab
::
IncomingEmail
.
supports_wildcard?
end
end
end
end
end
end
...
...
spec/controllers/projects/service_desk_controller_spec.rb
View file @
5f9eba6c
...
@@ -7,6 +7,8 @@ describe Projects::ServiceDeskController do
...
@@ -7,6 +7,8 @@ describe Projects::ServiceDeskController do
before
do
before
do
allow_any_instance_of
(
License
).
to
receive
(
:add_on?
).
and_call_original
allow_any_instance_of
(
License
).
to
receive
(
:add_on?
).
and_call_original
allow_any_instance_of
(
License
).
to
receive
(
:add_on?
).
with
(
'GitLab_ServiceDesk'
)
{
true
}
allow_any_instance_of
(
License
).
to
receive
(
:add_on?
).
with
(
'GitLab_ServiceDesk'
)
{
true
}
allow
(
Gitlab
::
IncomingEmail
).
to
receive
(
:enabled?
)
{
true
}
allow
(
Gitlab
::
IncomingEmail
).
to
receive
(
:supports_wildcard?
)
{
true
}
project
.
update
(
service_desk_enabled:
true
)
project
.
update
(
service_desk_enabled:
true
)
project
.
add_master
(
user
)
project
.
add_master
(
user
)
sign_in
(
user
)
sign_in
(
user
)
...
...
spec/features/projects/settings/ee/service_desk_setting_spec.rb
View file @
5f9eba6c
...
@@ -11,6 +11,8 @@ describe 'Service Desk Setting', js: true, feature: true do
...
@@ -11,6 +11,8 @@ describe 'Service Desk Setting', js: true, feature: true do
login_as
(
user
)
login_as
(
user
)
allow_any_instance_of
(
License
).
to
receive
(
:add_on?
).
and_call_original
allow_any_instance_of
(
License
).
to
receive
(
:add_on?
).
and_call_original
allow_any_instance_of
(
License
).
to
receive
(
:add_on?
).
with
(
'GitLab_ServiceDesk'
)
{
true
}
allow_any_instance_of
(
License
).
to
receive
(
:add_on?
).
with
(
'GitLab_ServiceDesk'
)
{
true
}
allow
(
::
Gitlab
::
IncomingEmail
).
to
receive
(
:enabled?
)
{
true
}
allow
(
::
Gitlab
::
IncomingEmail
).
to
receive
(
:supports_wildcard?
)
{
true
}
visit
edit_namespace_project_path
(
project
.
namespace
,
project
)
visit
edit_namespace_project_path
(
project
.
namespace
,
project
)
end
end
...
...
spec/lib/ee/gitlab/service_desk_spec.rb
0 → 100644
View file @
5f9eba6c
require
'spec_helper'
describe
EE
::
Gitlab
::
ServiceDesk
,
lib:
true
do
before
do
allow_any_instance_of
(
License
).
to
receive
(
:add_on?
).
and_call_original
allow_any_instance_of
(
License
).
to
receive
(
:add_on?
).
with
(
'GitLab_ServiceDesk'
)
{
true
}
allow
(
::
Gitlab
::
IncomingEmail
).
to
receive
(
:enabled?
)
{
true
}
allow
(
::
Gitlab
::
IncomingEmail
).
to
receive
(
:supports_wildcard?
)
{
true
}
end
subject
{
described_class
.
enabled?
}
it
{
is_expected
.
to
be_truthy
}
context
'when license does not support service desk'
do
before
do
allow_any_instance_of
(
License
).
to
receive
(
:add_on?
).
with
(
'GitLab_ServiceDesk'
)
{
false
}
end
it
{
is_expected
.
to
be_falsy
}
end
context
'when incoming emails are disabled'
do
before
do
allow
(
::
Gitlab
::
IncomingEmail
).
to
receive
(
:enabled?
)
{
false
}
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?
)
{
false
}
end
it
{
is_expected
.
to
be_falsy
}
end
end
spec/lib/gitlab/email/handler/service_desk_handler_spec.rb
View file @
5f9eba6c
...
@@ -21,6 +21,8 @@ describe Gitlab::Email::Handler::EE::ServiceDeskHandler do
...
@@ -21,6 +21,8 @@ describe Gitlab::Email::Handler::EE::ServiceDeskHandler do
allow_any_instance_of
(
License
).
to
receive
(
:add_on?
).
and_call_original
allow_any_instance_of
(
License
).
to
receive
(
:add_on?
).
and_call_original
allow_any_instance_of
(
License
).
to
receive
(
:add_on?
).
with
(
'GitLab_ServiceDesk'
)
{
true
}
allow_any_instance_of
(
License
).
to
receive
(
:add_on?
).
with
(
'GitLab_ServiceDesk'
)
{
true
}
allow
(
::
Gitlab
::
IncomingEmail
).
to
receive
(
:enabled?
)
{
true
}
allow
(
::
Gitlab
::
IncomingEmail
).
to
receive
(
:supports_wildcard?
)
{
true
}
end
end
it
'sends thank you the email and creates issue'
do
it
'sends thank you the email and creates issue'
do
...
...
spec/services/ee/notification_service_spec.rb
View file @
5f9eba6c
...
@@ -9,6 +9,8 @@ describe EE::NotificationService do
...
@@ -9,6 +9,8 @@ describe EE::NotificationService do
allow_any_instance_of
(
License
).
to
receive
(
:add_on?
).
and_call_original
allow_any_instance_of
(
License
).
to
receive
(
:add_on?
).
and_call_original
allow_any_instance_of
(
License
).
to
receive
(
:add_on?
).
with
(
'GitLab_ServiceDesk'
)
{
true
}
allow_any_instance_of
(
License
).
to
receive
(
:add_on?
).
with
(
'GitLab_ServiceDesk'
)
{
true
}
allow
(
::
Gitlab
::
IncomingEmail
).
to
receive
(
:enabled?
)
{
true
}
allow
(
::
Gitlab
::
IncomingEmail
).
to
receive
(
:supports_wildcard?
)
{
true
}
end
end
def
should_email!
def
should_email!
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment