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
9222459e
Commit
9222459e
authored
Mar 17, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restrict access to confidential issues on activity feed
parent
7d403ec4
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
5 deletions
+43
-5
app/helpers/events_helper.rb
app/helpers/events_helper.rb
+1
-1
app/models/event.rb
app/models/event.rb
+4
-2
app/views/events/_event.html.haml
app/views/events/_event.html.haml
+1
-1
features/steps/groups.rb
features/steps/groups.rb
+1
-1
spec/models/event_spec.rb
spec/models/event_spec.rb
+36
-0
No files found.
app/helpers/events_helper.rb
View file @
9222459e
...
@@ -194,7 +194,7 @@ module EventsHelper
...
@@ -194,7 +194,7 @@ module EventsHelper
end
end
def
event_to_atom
(
xml
,
event
)
def
event_to_atom
(
xml
,
event
)
if
event
.
proper?
if
event
.
proper?
(
current_user
)
xml
.
entry
do
xml
.
entry
do
event_link
=
event_feed_url
(
event
)
event_link
=
event_feed_url
(
event
)
event_title
=
event_feed_title
(
event
)
event_title
=
event_feed_title
(
event
)
...
...
app/models/event.rb
View file @
9222459e
...
@@ -73,15 +73,17 @@ class Event < ActiveRecord::Base
...
@@ -73,15 +73,17 @@ class Event < ActiveRecord::Base
end
end
end
end
def
proper?
def
proper?
(
user
=
nil
)
if
push?
if
push?
true
true
elsif
membership_changed?
elsif
membership_changed?
true
true
elsif
created_project?
elsif
created_project?
true
true
elsif
issue?
Ability
.
abilities
.
allowed?
(
user
,
:read_issue
,
issue
)
else
else
((
issue?
||
merge_request?
||
note?
)
&&
target
)
||
milestone?
((
merge_request?
||
note?
)
&&
target
)
||
milestone?
end
end
end
end
...
...
app/views/events/_event.html.haml
View file @
9222459e
-
if
event
.
proper?
-
if
event
.
proper?
(
current_user
)
.event-item
{
class:
"#{event.body? ? "
event
-
block
" : "
event
-
inline
" }"
}
.event-item
{
class:
"#{event.body? ? "
event
-
block
" : "
event
-
inline
" }"
}
.event-item-timestamp
.event-item-timestamp
#{
time_ago_with_tooltip
(
event
.
created_at
)
}
#{
time_ago_with_tooltip
(
event
.
created_at
)
}
...
...
features/steps/groups.rb
View file @
9222459e
...
@@ -35,7 +35,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
...
@@ -35,7 +35,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
end
end
step
'I should see projects activity feed'
do
step
'I should see projects activity feed'
do
expect
(
page
).
to
have_content
'
closed issue
'
expect
(
page
).
to
have_content
'
joined project
'
end
end
step
'I should see issues from group "Owned" assigned to me'
do
step
'I should see issues from group "Owned" assigned to me'
do
...
...
spec/models/event_spec.rb
View file @
9222459e
...
@@ -65,6 +65,42 @@ describe Event, models: true do
...
@@ -65,6 +65,42 @@ describe Event, models: true do
it
{
expect
(
@event
.
author
).
to
eq
(
@user
)
}
it
{
expect
(
@event
.
author
).
to
eq
(
@user
)
}
end
end
describe
'#proper?'
do
context
'issue event'
do
let
(
:project
)
{
create
(
:empty_project
,
:public
)
}
let
(
:non_member
)
{
create
(
:user
)
}
let
(
:member
)
{
create
(
:user
)
}
let
(
:author
)
{
create
(
:author
)
}
let
(
:assignee
)
{
create
(
:user
)
}
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:event
)
{
Event
.
new
(
project:
project
,
action:
Event
::
CREATED
,
target:
issue
,
author_id:
author
.
id
)
}
before
do
project
.
team
<<
[
member
,
:developer
]
end
context
'for non confidential issues'
do
let
(
:issue
)
{
create
(
:issue
,
project:
project
,
author:
author
,
assignee:
assignee
)
}
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
'for confidential issues'
do
let
(
:issue
)
{
create
(
:issue
,
:confidential
,
project:
project
,
author:
author
,
assignee:
assignee
)
}
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
end
describe
'.limit_recent'
do
describe
'.limit_recent'
do
let!
(
:event1
)
{
create
(
:closed_issue_event
)
}
let!
(
:event1
)
{
create
(
:closed_issue_event
)
}
let!
(
:event2
)
{
create
(
:closed_issue_event
)
}
let!
(
:event2
)
{
create
(
:closed_issue_event
)
}
...
...
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