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
iv
gitlab-ce
Commits
39a51f9e
Commit
39a51f9e
authored
Mar 24, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename `Event#proper?` to `Event#visible_to_user?`
parent
23956033
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
25 deletions
+25
-25
app/helpers/events_helper.rb
app/helpers/events_helper.rb
+1
-1
app/models/event.rb
app/models/event.rb
+1
-1
app/views/events/_event.html.haml
app/views/events/_event.html.haml
+1
-1
spec/models/event_spec.rb
spec/models/event_spec.rb
+22
-22
No files found.
app/helpers/events_helper.rb
View file @
39a51f9e
...
...
@@ -194,7 +194,7 @@ module EventsHelper
end
def
event_to_atom
(
xml
,
event
)
if
event
.
prop
er?
(
current_user
)
if
event
.
visible_to_us
er?
(
current_user
)
xml
.
entry
do
event_link
=
event_feed_url
(
event
)
event_title
=
event_feed_title
(
event
)
...
...
app/models/event.rb
View file @
39a51f9e
...
...
@@ -73,7 +73,7 @@ class Event < ActiveRecord::Base
end
end
def
prop
er?
(
user
=
nil
)
def
visible_to_us
er?
(
user
=
nil
)
if
push?
true
elsif
membership_changed?
...
...
app/views/events/_event.html.haml
View file @
39a51f9e
-
if
event
.
prop
er?
(
current_user
)
-
if
event
.
visible_to_us
er?
(
current_user
)
.event-item
{
class:
"#{event.body? ? "
event
-
block
" : "
event
-
inline
" }"
}
.event-item-timestamp
#{
time_ago_with_tooltip
(
event
.
created_at
)
}
...
...
spec/models/event_spec.rb
View file @
39a51f9e
...
...
@@ -59,13 +59,13 @@ describe Event, models: true do
end
it
{
expect
(
@event
.
push?
).
to
be_truthy
}
it
{
expect
(
@event
.
prop
er?
).
to
be_truthy
}
it
{
expect
(
@event
.
visible_to_us
er?
).
to
be_truthy
}
it
{
expect
(
@event
.
tag?
).
to
be_falsey
}
it
{
expect
(
@event
.
branch_name
).
to
eq
(
"master"
)
}
it
{
expect
(
@event
.
author
).
to
eq
(
@user
)
}
end
describe
'#
prop
er?'
do
describe
'#
visible_to_us
er?'
do
let
(
:project
)
{
create
(
:empty_project
,
:public
)
}
let
(
:non_member
)
{
create
(
:user
)
}
let
(
:member
)
{
create
(
:user
)
}
...
...
@@ -86,21 +86,21 @@ describe Event, models: true do
context
'for non confidential issues'
do
let
(
:target
)
{
issue
}
it
{
expect
(
event
.
prop
er?
(
non_member
)).
to
eq
true
}
it
{
expect
(
event
.
prop
er?
(
author
)).
to
eq
true
}
it
{
expect
(
event
.
prop
er?
(
assignee
)).
to
eq
true
}
it
{
expect
(
event
.
prop
er?
(
member
)).
to
eq
true
}
it
{
expect
(
event
.
prop
er?
(
admin
)).
to
eq
true
}
it
{
expect
(
event
.
visible_to_us
er?
(
non_member
)).
to
eq
true
}
it
{
expect
(
event
.
visible_to_us
er?
(
author
)).
to
eq
true
}
it
{
expect
(
event
.
visible_to_us
er?
(
assignee
)).
to
eq
true
}
it
{
expect
(
event
.
visible_to_us
er?
(
member
)).
to
eq
true
}
it
{
expect
(
event
.
visible_to_us
er?
(
admin
)).
to
eq
true
}
end
context
'for confidential issues'
do
let
(
:target
)
{
confidential_issue
}
it
{
expect
(
event
.
prop
er?
(
non_member
)).
to
eq
false
}
it
{
expect
(
event
.
prop
er?
(
author
)).
to
eq
true
}
it
{
expect
(
event
.
prop
er?
(
assignee
)).
to
eq
true
}
it
{
expect
(
event
.
prop
er?
(
member
)).
to
eq
true
}
it
{
expect
(
event
.
prop
er?
(
admin
)).
to
eq
true
}
it
{
expect
(
event
.
visible_to_us
er?
(
non_member
)).
to
eq
false
}
it
{
expect
(
event
.
visible_to_us
er?
(
author
)).
to
eq
true
}
it
{
expect
(
event
.
visible_to_us
er?
(
assignee
)).
to
eq
true
}
it
{
expect
(
event
.
visible_to_us
er?
(
member
)).
to
eq
true
}
it
{
expect
(
event
.
visible_to_us
er?
(
admin
)).
to
eq
true
}
end
end
...
...
@@ -108,21 +108,21 @@ describe Event, models: true do
context
'on non confidential issues'
do
let
(
:target
)
{
note_on_issue
}
it
{
expect
(
event
.
prop
er?
(
non_member
)).
to
eq
true
}
it
{
expect
(
event
.
prop
er?
(
author
)).
to
eq
true
}
it
{
expect
(
event
.
prop
er?
(
assignee
)).
to
eq
true
}
it
{
expect
(
event
.
prop
er?
(
member
)).
to
eq
true
}
it
{
expect
(
event
.
prop
er?
(
admin
)).
to
eq
true
}
it
{
expect
(
event
.
visible_to_us
er?
(
non_member
)).
to
eq
true
}
it
{
expect
(
event
.
visible_to_us
er?
(
author
)).
to
eq
true
}
it
{
expect
(
event
.
visible_to_us
er?
(
assignee
)).
to
eq
true
}
it
{
expect
(
event
.
visible_to_us
er?
(
member
)).
to
eq
true
}
it
{
expect
(
event
.
visible_to_us
er?
(
admin
)).
to
eq
true
}
end
context
'on confidential issues'
do
let
(
:target
)
{
note_on_confidential_issue
}
it
{
expect
(
event
.
prop
er?
(
non_member
)).
to
eq
false
}
it
{
expect
(
event
.
prop
er?
(
author
)).
to
eq
true
}
it
{
expect
(
event
.
prop
er?
(
assignee
)).
to
eq
true
}
it
{
expect
(
event
.
prop
er?
(
member
)).
to
eq
true
}
it
{
expect
(
event
.
prop
er?
(
admin
)).
to
eq
true
}
it
{
expect
(
event
.
visible_to_us
er?
(
non_member
)).
to
eq
false
}
it
{
expect
(
event
.
visible_to_us
er?
(
author
)).
to
eq
true
}
it
{
expect
(
event
.
visible_to_us
er?
(
assignee
)).
to
eq
true
}
it
{
expect
(
event
.
visible_to_us
er?
(
member
)).
to
eq
true
}
it
{
expect
(
event
.
visible_to_us
er?
(
admin
)).
to
eq
true
}
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