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
c9db6bb3
Commit
c9db6bb3
authored
Apr 02, 2012
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
"pushed to"
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
app/views/events/_event_push.html.haml
View file @
c9db6bb3
...
...
@@ -10,10 +10,10 @@
=
time_ago_in_words
(
event
.
created_at
)
ago.
-
if
event
.
md_ref
?
-
if
event
.
push_with_commits
?
-
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
%strong
#{
event
.
commits
.
first
.
commit
.
id
[
0
..
7
]
}
...
#{
event
.
commits
.
las
t
.
id
[
0
..
7
]
}
=
link_to
compare_project_commits_path
(
event
.
project
,
:from
=>
event
.
parent_commit
.
id
,
:to
=>
event
.
last_commi
t
.
id
)
do
%strong
#{
event
.
commits
.
first
.
id
[
0
..
7
]
}
...
#{
event
.
last_commi
t
.
id
[
0
..
7
]
}
-
project
=
event
.
project
%ul
.unstyled.event_commits
-
if
event
.
commits
.
size
>
3
...
...
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