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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
e5f83afc
Commit
e5f83afc
authored
Sep 21, 2018
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Event#visible_to_user? for milestones
parent
45ced6c5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
1 deletion
+38
-1
app/models/event.rb
app/models/event.rb
+1
-1
spec/models/event_spec.rb
spec/models/event_spec.rb
+37
-0
No files found.
app/models/event.rb
View file @
e5f83afc
...
@@ -160,7 +160,7 @@ class Event < ActiveRecord::Base
...
@@ -160,7 +160,7 @@ class Event < ActiveRecord::Base
elsif
merge_request?
||
merge_request_note?
elsif
merge_request?
||
merge_request_note?
Ability
.
allowed?
(
user
,
:read_merge_request
,
note?
?
note_target
:
target
)
Ability
.
allowed?
(
user
,
:read_merge_request
,
note?
?
note_target
:
target
)
elsif
milestone?
elsif
milestone?
Ability
.
allowed?
(
user
,
:read_
project
,
project
)
Ability
.
allowed?
(
user
,
:read_
milestone
,
project
)
else
else
false
# No other event types are visible
false
# No other event types are visible
end
end
...
...
spec/models/event_spec.rb
View file @
e5f83afc
...
@@ -151,6 +151,7 @@ describe Event do
...
@@ -151,6 +151,7 @@ describe Event do
let
(
:note_on_commit
)
{
create
(
:note_on_commit
,
project:
project
)
}
let
(
:note_on_commit
)
{
create
(
:note_on_commit
,
project:
project
)
}
let
(
:note_on_issue
)
{
create
(
:note_on_issue
,
noteable:
issue
,
project:
project
)
}
let
(
:note_on_issue
)
{
create
(
:note_on_issue
,
noteable:
issue
,
project:
project
)
}
let
(
:note_on_confidential_issue
)
{
create
(
:note_on_issue
,
noteable:
confidential_issue
,
project:
project
)
}
let
(
:note_on_confidential_issue
)
{
create
(
:note_on_issue
,
noteable:
confidential_issue
,
project:
project
)
}
let
(
:milestone_on_project
)
{
create
(
:milestone
,
project:
project
)
}
let
(
:event
)
{
described_class
.
new
(
project:
project
,
target:
target
,
author_id:
author
.
id
)
}
let
(
:event
)
{
described_class
.
new
(
project:
project
,
target:
target
,
author_id:
author
.
id
)
}
before
do
before
do
...
@@ -268,6 +269,42 @@ describe Event do
...
@@ -268,6 +269,42 @@ describe Event do
end
end
end
end
end
end
context
'milestone event'
do
let
(
:target
)
{
milestone_on_project
}
it
do
expect
(
event
.
visible_to_user?
(
nil
)).
to
be_truthy
expect
(
event
.
visible_to_user?
(
non_member
)).
to
be_truthy
expect
(
event
.
visible_to_user?
(
member
)).
to
be_truthy
expect
(
event
.
visible_to_user?
(
guest
)).
to
be_truthy
expect
(
event
.
visible_to_user?
(
admin
)).
to
be_truthy
end
context
'on public project with private issue tracker and merge requests'
do
let
(
:project
)
{
create
(
:project
,
:public
,
:issues_private
,
:merge_requests_private
)
}
it
do
expect
(
event
.
visible_to_user?
(
nil
)).
to
be_falsy
expect
(
event
.
visible_to_user?
(
non_member
)).
to
be_falsy
expect
(
event
.
visible_to_user?
(
member
)).
to
be_truthy
expect
(
event
.
visible_to_user?
(
guest
)).
to
be_truthy
expect
(
event
.
visible_to_user?
(
admin
)).
to
be_truthy
end
end
context
'on private project'
do
let
(
:project
)
{
create
(
:project
,
:private
)
}
it
do
expect
(
event
.
visible_to_user?
(
nil
)).
to
be_falsy
expect
(
event
.
visible_to_user?
(
non_member
)).
to
be_falsy
expect
(
event
.
visible_to_user?
(
member
)).
to
be_truthy
expect
(
event
.
visible_to_user?
(
guest
)).
to
be_truthy
expect
(
event
.
visible_to_user?
(
admin
)).
to
be_truthy
end
end
end
end
end
describe
'.limit_recent'
do
describe
'.limit_recent'
do
...
...
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