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
80b54eeb
Commit
80b54eeb
authored
Dec 29, 2016
by
Valery Sizov
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ee into ce_upstream
parents
68d6a2a2
0a6e660b
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
260 additions
and
45 deletions
+260
-45
CHANGELOG-EE.md
CHANGELOG-EE.md
+6
-1
CHANGELOG.md
CHANGELOG.md
+16
-0
app/assets/stylesheets/framework/gitlab-theme.scss
app/assets/stylesheets/framework/gitlab-theme.scss
+3
-0
app/assets/stylesheets/framework/sidebar.scss
app/assets/stylesheets/framework/sidebar.scss
+11
-0
app/models/concerns/issuable.rb
app/models/concerns/issuable.rb
+3
-2
app/services/issuable_base_service.rb
app/services/issuable_base_service.rb
+29
-12
app/services/issues/base_service.rb
app/services/issues/base_service.rb
+0
-4
app/services/merge_requests/base_service.rb
app/services/merge_requests/base_service.rb
+0
-4
app/views/layouts/nav/_dashboard.html.haml
app/views/layouts/nav/_dashboard.html.haml
+4
-0
changelogs/unreleased-ee/fix_es_for_non-default-branches.yml
changelogs/unreleased-ee/fix_es_for_non-default-branches.yml
+0
-4
changelogs/unreleased-ee/view-ce-vs-ee.yml
changelogs/unreleased-ee/view-ce-vs-ee.yml
+4
-0
changelogs/unreleased/issue_22664.yml
changelogs/unreleased/issue_22664.yml
+4
-0
lib/api/license.rb
lib/api/license.rb
+9
-13
spec/models/concerns/issuable_spec.rb
spec/models/concerns/issuable_spec.rb
+39
-0
spec/services/issuable/bulk_update_service_spec.rb
spec/services/issuable/bulk_update_service_spec.rb
+8
-4
spec/services/issues/create_service_spec.rb
spec/services/issues/create_service_spec.rb
+2
-0
spec/services/issues/update_service_spec.rb
spec/services/issues/update_service_spec.rb
+11
-0
spec/services/merge_requests/create_service_spec.rb
spec/services/merge_requests/create_service_spec.rb
+2
-0
spec/services/notes/slash_commands_service_spec.rb
spec/services/notes/slash_commands_service_spec.rb
+2
-0
spec/support/services/issuable_create_service_shared_examples.rb
...pport/services/issuable_create_service_shared_examples.rb
+52
-0
spec/support/services/issuable_create_service_slash_commands_shared_examples.rb
...issuable_create_service_slash_commands_shared_examples.rb
+3
-1
spec/support/services/issuable_update_service_shared_examples.rb
...pport/services/issuable_update_service_shared_examples.rb
+52
-0
No files found.
CHANGELOG-EE.md
View file @
80b54eeb
Please view this file on the master branch, on stable branches it's out of date.
Please view this file on the master branch, on stable branches it's out of date.
## 8.15.2 (2016-12-27)
-
No changes.
-
Fix ES search for non-default branches.
## 8.15.1 (2016-12-23)
## 8.15.1 (2016-12-23)
-
Fix 404/500 error while navigating to the 'show/destroy' pages. !993
-
Fix 404/500 error while navigating to the 'show/destroy' pages. !993
## 8.15.0 (201
7-01
-22)
## 8.15.0 (201
6-12
-22)
-
Adds a check ensure only active, ie. non-blocked users can be emailed from the admin panel.
-
Adds a check ensure only active, ie. non-blocked users can be emailed from the admin panel.
-
Add user activities API.
-
Add user activities API.
...
...
CHANGELOG.md
View file @
80b54eeb
...
@@ -2,6 +2,22 @@
...
@@ -2,6 +2,22 @@
documentation
](
doc/development/changelog.md
)
for instructions on adding your own
documentation
](
doc/development/changelog.md
)
for instructions on adding your own
entry.
entry.
## 8.15.2 (2016-12-27)
-
No changes.
-
Fix mr list timestamp alignment. !8271
-
Fix discussion overlap text in regular screens. !8273
-
Fixes mini-pipeline-graph dropdown animation and stage position in chrome, firefox and safari. !8282
-
Fix line breaking in nodes of the pipeline graph in firefox. !8292
-
Fixes confendential warning text alignment. !8293
-
Hide Scroll Top button for failed build page. !8295
-
Fix finding the latest pipeline. !8301
-
Disable PostgreSQL statement timeouts when removing unneeded services. !8322
-
Fix timeout when MR contains large files marked as binary by .gitattributes.
-
Rename "autodeploy" to "auto deploy".
-
Fixed GFM autocomplete error when no data exists.
-
Fixed resolve discussion note button color.
## 8.15.1 (2016-12-23)
## 8.15.1 (2016-12-23)
-
Push payloads schedule at most 100 commits, instead of all commits.
-
Push payloads schedule at most 100 commits, instead of all commits.
...
...
app/assets/stylesheets/framework/gitlab-theme.scss
View file @
80b54eeb
...
@@ -80,6 +80,9 @@
...
@@ -80,6 +80,9 @@
}
}
}
}
.about-gitlab
{
color
:
$color-light
;
}
}
}
}
}
}
}
...
...
app/assets/stylesheets/framework/sidebar.scss
View file @
80b54eeb
...
@@ -101,6 +101,17 @@
...
@@ -101,6 +101,17 @@
padding
:
0
8px
;
padding
:
0
8px
;
border-radius
:
6px
;
border-radius
:
6px
;
}
}
.about-gitlab
{
padding
:
7px
$gl-sidebar-padding
;
font-size
:
$gl-font-size
;
line-height
:
24px
;
display
:
block
;
text-decoration
:
none
;
font-weight
:
normal
;
position
:
absolute
;
bottom
:
10px
;
}
}
}
.sidebar-action-buttons
{
.sidebar-action-buttons
{
...
...
app/models/concerns/issuable.rb
View file @
80b54eeb
...
@@ -96,8 +96,9 @@ module Issuable
...
@@ -96,8 +96,9 @@ module Issuable
after_save
:record_metrics
after_save
:record_metrics
def
update_assignee_cache_counts
def
update_assignee_cache_counts
# make sure we flush the cache for both the old *and* new assignee
# make sure we flush the cache for both the old *and* new assignees(if they exist)
User
.
find
(
assignee_id_was
).
update_cache_counts
if
assignee_id_was
previous_assignee
=
User
.
find_by_id
(
assignee_id_was
)
if
assignee_id_was
previous_assignee
.
update_cache_counts
if
previous_assignee
assignee
.
update_cache_counts
if
assignee
assignee
.
update_cache_counts
if
assignee
end
end
...
...
app/services/issuable_base_service.rb
View file @
80b54eeb
...
@@ -44,14 +44,10 @@ class IssuableBaseService < BaseService
...
@@ -44,14 +44,10 @@ class IssuableBaseService < BaseService
SystemNoteService
.
change_time_spent
(
issuable
,
issuable
.
project
,
current_user
)
SystemNoteService
.
change_time_spent
(
issuable
,
issuable
.
project
,
current_user
)
end
end
def
filter_params
(
issuable_ability_name
=
:issue
)
def
filter_params
(
issuable
)
filter_assignee
ability_name
=
:"admin_
#{
issuable
.
to_ability_name
}
"
filter_milestone
filter_labels
ability
=
:"admin_
#{
issuable_ability_name
}
"
unless
can?
(
current_user
,
ability_name
,
project
)
unless
can?
(
current_user
,
ability
,
project
)
params
.
delete
(
:milestone_id
)
params
.
delete
(
:milestone_id
)
params
.
delete
(
:labels
)
params
.
delete
(
:labels
)
params
.
delete
(
:add_label_ids
)
params
.
delete
(
:add_label_ids
)
...
@@ -60,14 +56,35 @@ class IssuableBaseService < BaseService
...
@@ -60,14 +56,35 @@ class IssuableBaseService < BaseService
params
.
delete
(
:assignee_id
)
params
.
delete
(
:assignee_id
)
params
.
delete
(
:due_date
)
params
.
delete
(
:due_date
)
end
end
filter_assignee
(
issuable
)
filter_milestone
filter_labels
end
end
def
filter_assignee
def
filter_assignee
(
issuable
)
if
params
[
:assignee_id
]
==
IssuableFinder
::
NONE
return
unless
params
[
:assignee_id
].
present?
params
[
:assignee_id
]
=
''
assignee_id
=
params
[
:assignee_id
]
if
assignee_id
.
to_s
==
IssuableFinder
::
NONE
params
[
:assignee_id
]
=
""
else
params
.
delete
(
:assignee_id
)
unless
assignee_can_read?
(
issuable
,
assignee_id
)
end
end
end
end
def
assignee_can_read?
(
issuable
,
assignee_id
)
new_assignee
=
User
.
find_by_id
(
assignee_id
)
return
false
unless
new_assignee
.
present?
ability_name
=
:"read_
#{
issuable
.
to_ability_name
}
"
resource
=
issuable
.
persisted?
?
issuable
:
project
can?
(
new_assignee
,
ability_name
,
resource
)
end
def
filter_milestone
def
filter_milestone
milestone_id
=
params
[
:milestone_id
]
milestone_id
=
params
[
:milestone_id
]
return
unless
milestone_id
return
unless
milestone_id
...
@@ -146,7 +163,7 @@ class IssuableBaseService < BaseService
...
@@ -146,7 +163,7 @@ class IssuableBaseService < BaseService
def
create
(
issuable
)
def
create
(
issuable
)
merge_slash_commands_into_params!
(
issuable
)
merge_slash_commands_into_params!
(
issuable
)
filter_params
filter_params
(
issuable
)
change_time_spent
(
issuable
)
change_time_spent
(
issuable
)
params
.
delete
(
:state_event
)
params
.
delete
(
:state_event
)
...
@@ -190,7 +207,7 @@ class IssuableBaseService < BaseService
...
@@ -190,7 +207,7 @@ class IssuableBaseService < BaseService
change_subscription
(
issuable
)
change_subscription
(
issuable
)
change_todo
(
issuable
)
change_todo
(
issuable
)
time_spent
=
change_time_spent
(
issuable
)
time_spent
=
change_time_spent
(
issuable
)
filter_params
filter_params
(
issuable
)
old_labels
=
issuable
.
labels
.
to_a
old_labels
=
issuable
.
labels
.
to_a
old_mentioned_users
=
issuable
.
mentioned_users
.
to_a
old_mentioned_users
=
issuable
.
mentioned_users
.
to_a
...
...
app/services/issues/base_service.rb
View file @
80b54eeb
...
@@ -17,10 +17,6 @@ module Issues
...
@@ -17,10 +17,6 @@ module Issues
private
private
def
filter_params
super
(
:issue
)
end
def
execute_hooks
(
issue
,
action
=
'open'
)
def
execute_hooks
(
issue
,
action
=
'open'
)
issue_data
=
hook_data
(
issue
,
action
)
issue_data
=
hook_data
(
issue
,
action
)
hooks_scope
=
issue
.
confidential?
?
:confidential_issue_hooks
:
:issue_hooks
hooks_scope
=
issue
.
confidential?
?
:confidential_issue_hooks
:
:issue_hooks
...
...
app/services/merge_requests/base_service.rb
View file @
80b54eeb
...
@@ -38,10 +38,6 @@ module MergeRequests
...
@@ -38,10 +38,6 @@ module MergeRequests
private
private
def
filter_params
super
(
:merge_request
)
end
def
merge_requests_for
(
branch
)
def
merge_requests_for
(
branch
)
origin_merge_requests
=
@project
.
origin_merge_requests
origin_merge_requests
=
@project
.
origin_merge_requests
.
opened
.
where
(
source_branch:
branch
).
to_a
.
opened
.
where
(
source_branch:
branch
).
to_a
...
...
app/views/layouts/nav/_dashboard.html.haml
View file @
80b54eeb
...
@@ -35,3 +35,7 @@
...
@@ -35,3 +35,7 @@
=
link_to
dashboard_snippets_path
,
title:
'Snippets'
do
=
link_to
dashboard_snippets_path
,
title:
'Snippets'
do
%span
%span
Snippets
Snippets
=
link_to
help_path
,
title:
'About GitLab EE'
,
class:
'about-gitlab'
do
%span
About GitLab EE
changelogs/unreleased-ee/fix_es_for_non-default-branches.yml
deleted
100644 → 0
View file @
68d6a2a2
---
title
:
Fix ES search for non-default branches
merge_request
:
author
:
changelogs/unreleased-ee/view-ce-vs-ee.yml
0 → 100644
View file @
80b54eeb
---
title
:
About GitLab link in sidebar that links to help page
merge_request
:
1008
author
:
changelogs/unreleased/issue_22664.yml
0 → 100644
View file @
80b54eeb
---
title
:
Check if user can read project before being assigned to issue
merge_request
:
author
:
lib/api/license.rb
View file @
80b54eeb
...
@@ -3,26 +3,22 @@ module API
...
@@ -3,26 +3,22 @@ module API
before
{
authenticated_as_admin!
}
before
{
authenticated_as_admin!
}
resource
:license
do
resource
:license
do
# Get information on the currently active license
desc
'Get information on the currently active license'
do
#
success
Entities
::
License
# Example request:
end
# GET /license
get
do
get
do
license
=
::
License
.
current
license
=
::
License
.
current
present
license
,
with:
Entities
::
License
present
license
,
with:
Entities
::
License
end
end
# Add a new license
desc
'Add a new license'
do
#
success
Entities
::
License
# Parameters:
end
# license (required) - The license text
params
do
#
requires
:license
,
type:
String
,
desc:
'The license text'
# Example request:
end
# POST /license
post
do
post
do
required_attributes!
[
:license
]
license
=
::
License
.
new
(
data:
params
[
:license
])
license
=
::
License
.
new
(
data:
params
[
:license
])
if
license
.
save
if
license
.
save
present
license
,
with:
Entities
::
License
present
license
,
with:
Entities
::
License
...
...
spec/models/concerns/issuable_spec.rb
View file @
80b54eeb
...
@@ -44,6 +44,45 @@ describe Issue, "Issuable" do
...
@@ -44,6 +44,45 @@ describe Issue, "Issuable" do
it
{
expect
(
described_class
).
to
respond_to
(
:assigned
)
}
it
{
expect
(
described_class
).
to
respond_to
(
:assigned
)
}
end
end
describe
"before_save"
do
describe
"#update_cache_counts"
do
context
"when previous assignee exists"
do
before
do
assignee
=
create
(
:user
)
issue
.
project
.
team
<<
[
assignee
,
:developer
]
issue
.
update
(
assignee:
assignee
)
end
it
"updates cache counts for new assignee"
do
user
=
create
(
:user
)
expect
(
user
).
to
receive
(
:update_cache_counts
)
issue
.
update
(
assignee:
user
)
end
it
"updates cache counts for previous assignee"
do
old_assignee
=
issue
.
assignee
allow
(
User
).
to
receive
(
:find_by_id
).
with
(
old_assignee
.
id
).
and_return
(
old_assignee
)
expect
(
old_assignee
).
to
receive
(
:update_cache_counts
)
issue
.
update
(
assignee:
nil
)
end
end
context
"when previous assignee does not exist"
do
before
{
issue
.
update
(
assignee:
nil
)
}
it
"updates cache count for the new assignee"
do
expect_any_instance_of
(
User
).
to
receive
(
:update_cache_counts
)
issue
.
update
(
assignee:
user
)
end
end
end
end
describe
".search"
do
describe
".search"
do
let!
(
:searchable_issue
)
{
create
(
:issue
,
title:
"Searchable issue"
)
}
let!
(
:searchable_issue
)
{
create
(
:issue
,
title:
"Searchable issue"
)
}
...
...
spec/services/issuable/bulk_update_service_spec.rb
View file @
80b54eeb
...
@@ -52,7 +52,10 @@ describe Issuable::BulkUpdateService, services: true do
...
@@ -52,7 +52,10 @@ describe Issuable::BulkUpdateService, services: true do
context
'when the new assignee ID is a valid user'
do
context
'when the new assignee ID is a valid user'
do
it
'succeeds'
do
it
'succeeds'
do
result
=
bulk_update
(
issue
,
assignee_id:
create
(
:user
).
id
)
new_assignee
=
create
(
:user
)
project
.
team
<<
[
new_assignee
,
:developer
]
result
=
bulk_update
(
issue
,
assignee_id:
new_assignee
.
id
)
expect
(
result
[
:success
]).
to
be_truthy
expect
(
result
[
:success
]).
to
be_truthy
expect
(
result
[
:count
]).
to
eq
(
1
)
expect
(
result
[
:count
]).
to
eq
(
1
)
...
@@ -60,15 +63,16 @@ describe Issuable::BulkUpdateService, services: true do
...
@@ -60,15 +63,16 @@ describe Issuable::BulkUpdateService, services: true do
it
'updates the assignee to the use ID passed'
do
it
'updates the assignee to the use ID passed'
do
assignee
=
create
(
:user
)
assignee
=
create
(
:user
)
project
.
team
<<
[
assignee
,
:developer
]
expect
{
bulk_update
(
issue
,
assignee_id:
assignee
.
id
)
}
expect
{
bulk_update
(
issue
,
assignee_id:
assignee
.
id
)
}
.
to
change
{
issue
.
reload
.
assignee
}.
from
(
user
).
to
(
assignee
)
.
to
change
{
issue
.
reload
.
assignee
}.
from
(
user
).
to
(
assignee
)
end
end
end
end
context
'when the new assignee ID is -1'
do
context
"when the new assignee ID is
#{
IssuableFinder
::
NONE
}
"
do
it
'unassigns the issues'
do
it
"unassigns the issues"
do
expect
{
bulk_update
(
issue
,
assignee_id:
-
1
)
}
expect
{
bulk_update
(
issue
,
assignee_id:
IssuableFinder
::
NONE
)
}
.
to
change
{
issue
.
reload
.
assignee
}.
to
(
nil
)
.
to
change
{
issue
.
reload
.
assignee
}.
to
(
nil
)
end
end
end
end
...
...
spec/services/issues/create_service_spec.rb
View file @
80b54eeb
...
@@ -135,6 +135,8 @@ describe Issues::CreateService, services: true do
...
@@ -135,6 +135,8 @@ describe Issues::CreateService, services: true do
end
end
end
end
it_behaves_like
'issuable create service'
it_behaves_like
'new issuable record that supports slash commands'
it_behaves_like
'new issuable record that supports slash commands'
context
'for a merge request'
do
context
'for a merge request'
do
...
...
spec/services/issues/update_service_spec.rb
View file @
80b54eeb
...
@@ -142,6 +142,17 @@ describe Issues::UpdateService, services: true do
...
@@ -142,6 +142,17 @@ describe Issues::UpdateService, services: true do
update_issue
(
confidential:
true
)
update_issue
(
confidential:
true
)
end
end
it
'does not update assignee_id with unauthorized users'
do
project
.
update
(
visibility_level:
Gitlab
::
VisibilityLevel
::
PUBLIC
)
update_issue
(
confidential:
true
)
non_member
=
create
(
:user
)
original_assignee
=
issue
.
assignee
update_issue
(
assignee_id:
non_member
.
id
)
expect
(
issue
.
reload
.
assignee_id
).
to
eq
(
original_assignee
.
id
)
end
end
end
context
'todos'
do
context
'todos'
do
...
...
spec/services/merge_requests/create_service_spec.rb
View file @
80b54eeb
...
@@ -84,6 +84,8 @@ describe MergeRequests::CreateService, services: true do
...
@@ -84,6 +84,8 @@ describe MergeRequests::CreateService, services: true do
end
end
end
end
it_behaves_like
'issuable create service'
context
'while saving references to issues that the created merge request closes'
do
context
'while saving references to issues that the created merge request closes'
do
let
(
:first_issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:first_issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:second_issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:second_issue
)
{
create
(
:issue
,
project:
project
)
}
...
...
spec/services/notes/slash_commands_service_spec.rb
View file @
80b54eeb
...
@@ -5,6 +5,8 @@ describe Notes::SlashCommandsService, services: true do
...
@@ -5,6 +5,8 @@ describe Notes::SlashCommandsService, services: true do
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:master
)
{
create
(
:user
).
tap
{
|
u
|
project
.
team
<<
[
u
,
:master
]
}
}
let
(
:master
)
{
create
(
:user
).
tap
{
|
u
|
project
.
team
<<
[
u
,
:master
]
}
}
let
(
:assignee
)
{
create
(
:user
)
}
let
(
:assignee
)
{
create
(
:user
)
}
before
{
project
.
team
<<
[
assignee
,
:master
]
}
end
end
shared_examples
'note on noteable that does not support slash commands'
do
shared_examples
'note on noteable that does not support slash commands'
do
...
...
spec/support/services/issuable_create_service_shared_examples.rb
0 → 100644
View file @
80b54eeb
shared_examples
'issuable create service'
do
context
'asssignee_id'
do
let
(
:assignee
)
{
create
(
:user
)
}
before
{
project
.
team
<<
[
user
,
:master
]
}
it
'removes assignee_id when user id is invalid'
do
opts
=
{
title:
'Title'
,
description:
'Description'
,
assignee_id:
-
1
}
issuable
=
described_class
.
new
(
project
,
user
,
opts
).
execute
expect
(
issuable
.
assignee_id
).
to
be_nil
end
it
'removes assignee_id when user id is 0'
do
opts
=
{
title:
'Title'
,
description:
'Description'
,
assignee_id:
0
}
issuable
=
described_class
.
new
(
project
,
user
,
opts
).
execute
expect
(
issuable
.
assignee_id
).
to
be_nil
end
it
'saves assignee when user id is valid'
do
project
.
team
<<
[
assignee
,
:master
]
opts
=
{
title:
'Title'
,
description:
'Description'
,
assignee_id:
assignee
.
id
}
issuable
=
described_class
.
new
(
project
,
user
,
opts
).
execute
expect
(
issuable
.
assignee_id
).
to
eq
(
assignee
.
id
)
end
context
"when issuable feature is private"
do
before
do
project
.
project_feature
.
update
(
issues_access_level:
ProjectFeature
::
PRIVATE
)
project
.
project_feature
.
update
(
merge_requests_access_level:
ProjectFeature
::
PRIVATE
)
end
levels
=
[
Gitlab
::
VisibilityLevel
::
INTERNAL
,
Gitlab
::
VisibilityLevel
::
PUBLIC
]
levels
.
each
do
|
level
|
it
"removes not authorized assignee when project is
#{
Gitlab
::
VisibilityLevel
.
level_name
(
level
)
}
"
do
project
.
update
(
visibility_level:
level
)
opts
=
{
title:
'Title'
,
description:
'Description'
,
assignee_id:
assignee
.
id
}
issuable
=
described_class
.
new
(
project
,
user
,
opts
).
execute
expect
(
issuable
.
assignee_id
).
to
be_nil
end
end
end
end
end
spec/support/services/issuable_create_service_slash_commands_shared_examples.rb
View file @
80b54eeb
...
@@ -11,6 +11,8 @@ shared_examples 'new issuable record that supports slash commands' do
...
@@ -11,6 +11,8 @@ shared_examples 'new issuable record that supports slash commands' do
let
(
:params
)
{
base_params
.
merge
(
defined?
(
default_params
)
?
default_params
:
{}).
merge
(
example_params
)
}
let
(
:params
)
{
base_params
.
merge
(
defined?
(
default_params
)
?
default_params
:
{}).
merge
(
example_params
)
}
let
(
:issuable
)
{
described_class
.
new
(
project
,
user
,
params
).
execute
}
let
(
:issuable
)
{
described_class
.
new
(
project
,
user
,
params
).
execute
}
before
{
project
.
team
<<
[
assignee
,
:master
]
}
context
'with labels in command only'
do
context
'with labels in command only'
do
let
(
:example_params
)
do
let
(
:example_params
)
do
{
{
...
@@ -55,7 +57,7 @@ shared_examples 'new issuable record that supports slash commands' do
...
@@ -55,7 +57,7 @@ shared_examples 'new issuable record that supports slash commands' do
context
'with assignee and milestone in params and command'
do
context
'with assignee and milestone in params and command'
do
let
(
:example_params
)
do
let
(
:example_params
)
do
{
{
assignee:
build_stubbed
(
:user
),
assignee:
create
(
:user
),
milestone_id:
double
(
:milestone
),
milestone_id:
double
(
:milestone
),
description:
%(/assign @#{assignee.username}\n/milestone %"#{milestone.name}")
description:
%(/assign @#{assignee.username}\n/milestone %"#{milestone.name}")
}
}
...
...
spec/support/services/issuable_update_service_shared_examples.rb
View file @
80b54eeb
shared_examples
'issuable update service'
do
shared_examples
'issuable update service'
do
def
update_issuable
(
opts
)
described_class
.
new
(
project
,
user
,
opts
).
execute
(
open_issuable
)
end
context
'changing state'
do
context
'changing state'
do
before
{
expect
(
project
).
to
receive
(
:execute_hooks
).
once
}
before
{
expect
(
project
).
to
receive
(
:execute_hooks
).
once
}
...
@@ -14,4 +18,52 @@ shared_examples 'issuable update service' do
...
@@ -14,4 +18,52 @@ shared_examples 'issuable update service' do
end
end
end
end
end
end
context
'asssignee_id'
do
it
'does not update assignee when assignee_id is invalid'
do
open_issuable
.
update
(
assignee_id:
user
.
id
)
update_issuable
(
assignee_id:
-
1
)
expect
(
open_issuable
.
reload
.
assignee
).
to
eq
(
user
)
end
it
'unassigns assignee when user id is 0'
do
open_issuable
.
update
(
assignee_id:
user
.
id
)
update_issuable
(
assignee_id:
0
)
expect
(
open_issuable
.
assignee_id
).
to
be_nil
end
it
'saves assignee when user id is valid'
do
update_issuable
(
assignee_id:
user
.
id
)
expect
(
open_issuable
.
assignee_id
).
to
eq
(
user
.
id
)
end
it
'does not update assignee_id when user cannot read issue'
do
non_member
=
create
(
:user
)
original_assignee
=
open_issuable
.
assignee
update_issuable
(
assignee_id:
non_member
.
id
)
expect
(
open_issuable
.
assignee_id
).
to
eq
(
original_assignee
.
id
)
end
context
"when issuable feature is private"
do
levels
=
[
Gitlab
::
VisibilityLevel
::
INTERNAL
,
Gitlab
::
VisibilityLevel
::
PUBLIC
]
levels
.
each
do
|
level
|
it
"does not update with unauthorized assignee when project is
#{
Gitlab
::
VisibilityLevel
.
level_name
(
level
)
}
"
do
assignee
=
create
(
:user
)
project
.
update
(
visibility_level:
level
)
feature_visibility_attr
=
:"
#{
open_issuable
.
model_name
.
plural
}
_access_level"
project
.
project_feature
.
update_attribute
(
feature_visibility_attr
,
ProjectFeature
::
PRIVATE
)
expect
{
update_issuable
(
assignee_id:
assignee
)
}.
not_to
change
{
open_issuable
.
assignee
}
end
end
end
end
end
end
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