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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
23956033
Commit
23956033
authored
Mar 24, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Comments on confidential issues doesn't show in activity feed to non-members
parent
6b95be1d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
16 deletions
+49
-16
CHANGELOG
CHANGELOG
+3
-0
app/models/event.rb
app/models/event.rb
+6
-2
spec/models/event_spec.rb
spec/models/event_spec.rb
+40
-14
No files found.
CHANGELOG
View file @
23956033
...
@@ -5,6 +5,9 @@ v 8.7.0 (unreleased)
...
@@ -5,6 +5,9 @@ v 8.7.0 (unreleased)
- Make HTTP(s) label consistent on clone bar (Stan Hu)
- Make HTTP(s) label consistent on clone bar (Stan Hu)
- Fix avatar stretching by providing a cropping feature
- Fix avatar stretching by providing a cropping feature
v 8.6.2 (unreleased)
- Comments on confidential issues don't show up in activity feed to non-members
v 8.6.1
v 8.6.1
- Add option to reload the schema before restoring a database backup. !2807
- Add option to reload the schema before restoring a database backup. !2807
- Display navigation controls on mobile. !3214
- Display navigation controls on mobile. !3214
...
...
app/models/event.rb
View file @
23956033
...
@@ -80,8 +80,8 @@ class Event < ActiveRecord::Base
...
@@ -80,8 +80,8 @@ class Event < ActiveRecord::Base
true
true
elsif
created_project?
elsif
created_project?
true
true
elsif
issue?
elsif
issue?
||
issue_note?
Ability
.
abilities
.
allowed?
(
user
,
:read_issue
,
issue
)
Ability
.
abilities
.
allowed?
(
user
,
:read_issue
,
note?
?
note_target
:
target
)
else
else
((
merge_request?
||
note?
)
&&
target
)
||
milestone?
((
merge_request?
||
note?
)
&&
target
)
||
milestone?
end
end
...
@@ -298,6 +298,10 @@ class Event < ActiveRecord::Base
...
@@ -298,6 +298,10 @@ class Event < ActiveRecord::Base
target
.
noteable_type
==
"Commit"
target
.
noteable_type
==
"Commit"
end
end
def
issue_note?
note?
&&
target
&&
target
.
noteable_type
==
"Issue"
end
def
note_project_snippet?
def
note_project_snippet?
target
.
noteable_type
==
"Snippet"
target
.
noteable_type
==
"Snippet"
end
end
...
...
spec/models/event_spec.rb
View file @
23956033
...
@@ -66,21 +66,25 @@ describe Event, models: true do
...
@@ -66,21 +66,25 @@ describe Event, models: true do
end
end
describe
'#proper?'
do
describe
'#proper?'
do
context
'issue event'
do
let
(
:project
)
{
create
(
:empty_project
,
:public
)
}
let
(
:project
)
{
create
(
:empty_project
,
:public
)
}
let
(
:non_member
)
{
create
(
:user
)
}
let
(
:non_member
)
{
create
(
:user
)
}
let
(
:member
)
{
create
(
:user
)
}
let
(
:member
)
{
create
(
:user
)
}
let
(
:author
)
{
create
(
:author
)
}
let
(
:author
)
{
create
(
:author
)
}
let
(
:assignee
)
{
create
(
:user
)
}
let
(
:assignee
)
{
create
(
:user
)
}
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
,
author:
author
,
assignee:
assignee
)
}
let
(
:event
)
{
Event
.
new
(
project:
project
,
action:
Event
::
CREATED
,
target:
issue
,
author_id:
author
.
id
)
}
let
(
:confidential_issue
)
{
create
(
:issue
,
:confidential
,
project:
project
,
author:
author
,
assignee:
assignee
)
}
let
(
:note_on_issue
)
{
create
(
:note_on_issue
,
noteable:
issue
,
project:
project
)
}
before
do
let
(
:note_on_confidential_issue
)
{
create
(
:note_on_issue
,
noteable:
confidential_issue
,
project:
project
)
}
project
.
team
<<
[
member
,
:developer
]
let
(
:event
)
{
Event
.
new
(
project:
project
,
target:
target
,
author_id:
author
.
id
)
}
end
before
do
project
.
team
<<
[
member
,
:developer
]
end
context
'issue event'
do
context
'for non confidential issues'
do
context
'for non confidential issues'
do
let
(
:
issue
)
{
create
(
:issue
,
project:
project
,
author:
author
,
assignee:
assignee
)
}
let
(
:
target
)
{
issue
}
it
{
expect
(
event
.
proper?
(
non_member
)).
to
eq
true
}
it
{
expect
(
event
.
proper?
(
non_member
)).
to
eq
true
}
it
{
expect
(
event
.
proper?
(
author
)).
to
eq
true
}
it
{
expect
(
event
.
proper?
(
author
)).
to
eq
true
}
...
@@ -90,7 +94,29 @@ describe Event, models: true do
...
@@ -90,7 +94,29 @@ describe Event, models: true do
end
end
context
'for confidential issues'
do
context
'for confidential issues'
do
let
(
:issue
)
{
create
(
:issue
,
:confidential
,
project:
project
,
author:
author
,
assignee:
assignee
)
}
let
(
:target
)
{
confidential_issue
}
it
{
expect
(
event
.
proper?
(
non_member
)).
to
eq
false
}
it
{
expect
(
event
.
proper?
(
author
)).
to
eq
true
}
it
{
expect
(
event
.
proper?
(
assignee
)).
to
eq
true
}
it
{
expect
(
event
.
proper?
(
member
)).
to
eq
true
}
it
{
expect
(
event
.
proper?
(
admin
)).
to
eq
true
}
end
end
context
'note event'
do
context
'on non confidential issues'
do
let
(
:target
)
{
note_on_issue
}
it
{
expect
(
event
.
proper?
(
non_member
)).
to
eq
true
}
it
{
expect
(
event
.
proper?
(
author
)).
to
eq
true
}
it
{
expect
(
event
.
proper?
(
assignee
)).
to
eq
true
}
it
{
expect
(
event
.
proper?
(
member
)).
to
eq
true
}
it
{
expect
(
event
.
proper?
(
admin
)).
to
eq
true
}
end
context
'on confidential issues'
do
let
(
:target
)
{
note_on_confidential_issue
}
it
{
expect
(
event
.
proper?
(
non_member
)).
to
eq
false
}
it
{
expect
(
event
.
proper?
(
non_member
)).
to
eq
false
}
it
{
expect
(
event
.
proper?
(
author
)).
to
eq
true
}
it
{
expect
(
event
.
proper?
(
author
)).
to
eq
true
}
...
...
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