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
0ba03d7e
Commit
0ba03d7e
authored
Nov 24, 2016
by
Yorick Peterse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed data-user-is view code
With events no longer being cached this is no longer needed.
parent
5371da34
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
33 deletions
+25
-33
app/models/event.rb
app/models/event.rb
+4
-0
app/views/events/event/_push.html.haml
app/views/events/event/_push.html.haml
+3
-3
app/views/layouts/_head.html.haml
app/views/layouts/_head.html.haml
+0
-2
app/views/layouts/_user_styles.html.haml
app/views/layouts/_user_styles.html.haml
+0
-24
spec/models/event_spec.rb
spec/models/event_spec.rb
+18
-0
spec/views/layouts/_head.html.haml_spec.rb
spec/views/layouts/_head.html.haml_spec.rb
+0
-4
No files found.
app/models/event.rb
View file @
0ba03d7e
...
@@ -347,6 +347,10 @@ class Event < ActiveRecord::Base
...
@@ -347,6 +347,10 @@ class Event < ActiveRecord::Base
update_all
(
last_activity_at:
created_at
)
update_all
(
last_activity_at:
created_at
)
end
end
def
authored_by?
(
user
)
user
?
author_id
==
user
.
id
:
false
end
private
private
def
recent_update?
def
recent_update?
...
...
app/views/events/event/_push.html.haml
View file @
0ba03d7e
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
-
few_commits
.
each
do
|
commit
|
-
few_commits
.
each
do
|
commit
|
=
render
"events/commit"
,
commit:
commit
,
project:
project
,
event:
event
=
render
"events/commit"
,
commit:
commit
,
project:
project
,
event:
event
-
create_mr
=
event
.
new_ref?
&&
create_mr_button?
(
project
.
default_branch
,
event
.
ref_name
,
project
)
-
create_mr
=
event
.
new_ref?
&&
create_mr_button?
(
project
.
default_branch
,
event
.
ref_name
,
project
)
&&
event
.
authored_by?
(
current_user
)
-
if
event
.
commits_count
>
1
-
if
event
.
commits_count
>
1
%li
.commits-stat
%li
.commits-stat
-
if
event
.
commits_count
>
2
-
if
event
.
commits_count
>
2
...
@@ -35,12 +35,12 @@
...
@@ -35,12 +35,12 @@
Compare
#{
from_label
}
...
#{
truncate_sha
(
event
.
commit_to
)
}
Compare
#{
from_label
}
...
#{
truncate_sha
(
event
.
commit_to
)
}
-
if
create_mr
-
if
create_mr
%span
{
"data-user-is"
=>
event
.
author_id
,
"data-display"
=>
"inline"
}
%span
or
or
=
link_to
create_mr_path
(
project
.
default_branch
,
event
.
ref_name
,
project
)
do
=
link_to
create_mr_path
(
project
.
default_branch
,
event
.
ref_name
,
project
)
do
create a merge request
create a merge request
-
elsif
create_mr
-
elsif
create_mr
%li
.commits-stat
{
"data-user-is"
=>
event
.
author_id
}
%li
.commits-stat
=
link_to
create_mr_path
(
project
.
default_branch
,
event
.
ref_name
,
project
)
do
=
link_to
create_mr_path
(
project
.
default_branch
,
event
.
ref_name
,
project
)
do
Create Merge Request
Create Merge Request
-
elsif
event
.
rm_ref?
-
elsif
event
.
rm_ref?
...
...
app/views/layouts/_head.html.haml
View file @
0ba03d7e
...
@@ -56,5 +56,3 @@
...
@@ -56,5 +56,3 @@
=
render
'layouts/google_analytics'
if
extra_config
.
has_key?
(
'google_analytics_id'
)
=
render
'layouts/google_analytics'
if
extra_config
.
has_key?
(
'google_analytics_id'
)
=
render
'layouts/piwik'
if
extra_config
.
has_key?
(
'piwik_url'
)
&&
extra_config
.
has_key?
(
'piwik_site_id'
)
=
render
'layouts/piwik'
if
extra_config
.
has_key?
(
'piwik_url'
)
&&
extra_config
.
has_key?
(
'piwik_site_id'
)
=
render
'layouts/bootlint'
if
Rails
.
env
.
development?
=
render
'layouts/bootlint'
if
Rails
.
env
.
development?
=
render
'layouts/user_styles'
app/views/layouts/_user_styles.html.haml
deleted
100644 → 0
View file @
5371da34
:css
[
data-user-is
]
{
display
:
none
!important
;
}
[
data-user-is
=
"
#{
current_user
.
try
(
:id
)
}
"
]
{
display
:
block
!important
;
}
[
data-user-is
=
"
#{
current_user
.
try
(
:id
)
}
"][data-display="
inline
"
]
{
display
:
inline
!important
;
}
[
data-user-is-not
]
{
display
:
block
!important
;
}
[
data-user-is-not
][
data-display
=
"inline"
]
{
display
:
inline
!important
;
}
[
data-user-is-not
=
"
#{
current_user
.
try
(
:id
)
}
"
]
{
display
:
none
!important
;
}
spec/models/event_spec.rb
View file @
0ba03d7e
...
@@ -260,6 +260,24 @@ describe Event, models: true do
...
@@ -260,6 +260,24 @@ describe Event, models: true do
end
end
end
end
describe
'#authored_by?'
do
let
(
:event
)
{
build
(
:event
)
}
it
'returns true when the event author and user are the same'
do
expect
(
event
.
authored_by?
(
event
.
author
)).
to
eq
(
true
)
end
it
'returns false when passing nil as an argument'
do
expect
(
event
.
authored_by?
(
nil
)).
to
eq
(
false
)
end
it
'returns false when the given user is not the author of the event'
do
user
=
double
(
:user
,
id:
-
1
)
expect
(
event
.
authored_by?
(
user
)).
to
eq
(
false
)
end
end
def
create_event
(
project
,
user
,
attrs
=
{})
def
create_event
(
project
,
user
,
attrs
=
{})
data
=
{
data
=
{
before:
Gitlab
::
Git
::
BLANK_SHA
,
before:
Gitlab
::
Git
::
BLANK_SHA
,
...
...
spec/views/layouts/_head.html.haml_spec.rb
View file @
0ba03d7e
require
'spec_helper'
require
'spec_helper'
describe
'layouts/_head'
do
describe
'layouts/_head'
do
before
do
stub_template
'layouts/_user_styles.html.haml'
=>
''
end
it
'escapes HTML-safe strings in page_title'
do
it
'escapes HTML-safe strings in page_title'
do
stub_helper_with_safe_string
(
:page_title
)
stub_helper_with_safe_string
(
:page_title
)
...
...
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