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
Tatuya Kamada
gitlab-ce
Commits
c9db6bb3
Commit
c9db6bb3
authored
12 years ago
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prevent app crash for events without git resources
parent
f1799a23
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
app/models/event/push_trait.rb
app/models/event/push_trait.rb
+14
-0
app/views/events/_event_push.html.haml
app/views/events/_event_push.html.haml
+3
-3
No files found.
app/models/event/push_trait.rb
View file @
c9db6bb3
...
@@ -63,5 +63,19 @@ module Event::PushTrait
...
@@ -63,5 +63,19 @@ module Event::PushTrait
"pushed to"
"pushed to"
end
end
end
end
def
parent_commit
commits
.
first
.
prev_commit
rescue
=>
ex
nil
end
def
last_commit
commits
.
last
end
def
push_with_commits?
md_ref?
&&
commits
.
any?
&&
parent_commit
&&
last_commit
end
end
end
end
end
This diff is collapsed.
Click to expand it.
app/views/events/_event_push.html.haml
View file @
c9db6bb3
...
@@ -10,10 +10,10 @@
...
@@ -10,10 +10,10 @@
=
time_ago_in_words
(
event
.
created_at
)
=
time_ago_in_words
(
event
.
created_at
)
ago.
ago.
-
if
event
.
md_ref
?
-
if
event
.
push_with_commits
?
-
if
event
.
commits
.
count
>
1
-
if
event
.
commits
.
count
>
1
=
link_to
compare_project_commits_path
(
event
.
project
,
:from
=>
event
.
commits
.
first
.
prev_commit_id
,
:to
=>
event
.
commits
.
las
t
.
id
)
do
=
link_to
compare_project_commits_path
(
event
.
project
,
:from
=>
event
.
parent_commit
.
id
,
:to
=>
event
.
last_commi
t
.
id
)
do
%strong
#{
event
.
commits
.
first
.
commit
.
id
[
0
..
7
]
}
...
#{
event
.
commits
.
las
t
.
id
[
0
..
7
]
}
%strong
#{
event
.
commits
.
first
.
id
[
0
..
7
]
}
...
#{
event
.
last_commi
t
.
id
[
0
..
7
]
}
-
project
=
event
.
project
-
project
=
event
.
project
%ul
.unstyled.event_commits
%ul
.unstyled.event_commits
-
if
event
.
commits
.
size
>
3
-
if
event
.
commits
.
size
>
3
...
...
This diff is collapsed.
Click to expand it.
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