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
ff4471a3
Commit
ff4471a3
authored
Apr 05, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get rid of event decorator. Use event data hash instead commit objects to increase perfomance
parent
c33d5e16
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
48 additions
and
53 deletions
+48
-53
app/decorators/event_decorator.rb
app/decorators/event_decorator.rb
+0
-44
app/helpers/events_helper.rb
app/helpers/events_helper.rb
+41
-0
app/views/events/_event_push.atom.haml
app/views/events/_event_push.atom.haml
+5
-5
app/views/events/event/_push.html.haml
app/views/events/event/_push.html.haml
+2
-2
app/views/groups/show.atom.builder
app/views/groups/show.atom.builder
+0
-1
app/views/teams/show.atom.builder
app/views/teams/show.atom.builder
+0
-1
No files found.
app/decorators/event_decorator.rb
deleted
100644 → 0
View file @
c33d5e16
class
EventDecorator
<
ApplicationDecorator
decorates
:event
def
feed_title
if
self
.
issue?
"
#{
self
.
author_name
}
#{
self
.
action_name
}
issue #
#{
self
.
target_id
}
:
#{
self
.
issue_title
}
at
#{
self
.
project
.
name
}
"
elsif
self
.
merge_request?
"
#{
self
.
author_name
}
#{
self
.
action_name
}
MR #
#{
self
.
target_id
}
:
#{
self
.
merge_request_title
}
at
#{
self
.
project
.
name
}
"
elsif
self
.
push?
"
#{
self
.
author_name
}
#{
self
.
push_action_name
}
#{
self
.
ref_type
}
#{
self
.
ref_name
}
at
#{
self
.
project
.
name
}
"
elsif
self
.
membership_changed?
"
#{
self
.
author_name
}
#{
self
.
action_name
}
#{
self
.
project
.
name
}
"
else
""
end
end
def
feed_url
if
self
.
issue?
h
.
project_issue_url
(
self
.
project
,
self
.
issue
)
elsif
self
.
merge_request?
h
.
project_merge_request_url
(
self
.
project
,
self
.
merge_request
)
elsif
self
.
push?
if
self
.
push_with_commits?
if
self
.
commits_count
>
1
h
.
project_compare_url
(
self
.
project
,
:from
=>
self
.
parent_commit
.
id
,
:to
=>
self
.
last_commit
.
id
)
else
h
.
project_commit_url
(
self
.
project
,
:id
=>
self
.
last_commit
.
id
)
end
else
h
.
project_commits_url
(
self
.
project
,
self
.
ref_name
)
end
end
end
def
feed_summary
if
self
.
issue?
h
.
render
"events/event_issue"
,
issue:
self
.
issue
elsif
self
.
push?
h
.
render
"events/event_push"
,
event:
self
end
end
end
app/helpers/events_helper.rb
View file @
ff4471a3
...
@@ -42,4 +42,45 @@ module EventsHelper
...
@@ -42,4 +42,45 @@ module EventsHelper
EventFilter
.
team
=>
"icon-user"
,
EventFilter
.
team
=>
"icon-user"
,
}
}
end
end
def
event_feed_title
(
event
)
if
event
.
issue?
"
#{
event
.
author_name
}
#{
event
.
action_name
}
issue #
#{
event
.
target_id
}
:
#{
event
.
issue_title
}
at
#{
event
.
project
.
name
}
"
elsif
event
.
merge_request?
"
#{
event
.
author_name
}
#{
event
.
action_name
}
MR #
#{
event
.
target_id
}
:
#{
event
.
merge_request_title
}
at
#{
event
.
project
.
name
}
"
elsif
event
.
push?
"
#{
event
.
author_name
}
#{
event
.
push_action_name
}
#{
event
.
ref_type
}
#{
event
.
ref_name
}
at
#{
event
.
project
.
name
}
"
elsif
event
.
membership_changed?
"
#{
event
.
author_name
}
#{
event
.
action_name
}
#{
event
.
project
.
name
}
"
else
""
end
end
def
event_feed_url
(
event
)
if
event
.
issue?
project_issue_url
(
event
.
project
,
event
.
issue
)
elsif
event
.
merge_request?
project_merge_request_url
(
event
.
project
,
event
.
merge_request
)
elsif
event
.
push?
if
event
.
push_with_commits?
if
event
.
commits_count
>
1
project_compare_url
(
event
.
project
,
from:
event
.
commit_from
,
to:
event
.
commit_to
)
else
project_commit_url
(
event
.
project
,
id:
event
.
commit_to
)
end
else
project_commits_url
(
event
.
project
,
event
.
ref_name
)
end
end
end
def
event_feed_summary
(
event
)
if
event
.
issue?
render
"events/event_issue"
,
issue:
event
.
issue
elsif
event
.
push?
render
"events/event_push"
,
event:
event
end
end
end
end
app/views/events/_event_push.atom.haml
View file @
ff4471a3
%div
{
:xmlns
=>
"http://www.w3.org/1999/xhtml"
}
%div
{
xmlns:
"http://www.w3.org/1999/xhtml"
}
-
event
.
commits
.
first
(
15
).
each
do
|
commit
|
-
event
.
commits
.
first
(
15
).
each
do
|
commit
|
%p
%p
%strong
=
commit
.
author_name
%strong
=
commit
[
:author
][
:name
]
=
link_to
"(#
#{
commit
.
short_id
}
)"
,
project_commit_path
(
event
.
project
,
:id
=>
commit
.
id
)
=
link_to
"(#
#{
commit
[
:id
][
0
...
8
]
}
)"
,
project_commit_path
(
event
.
project
,
id:
commit
[
:id
]
)
%i
%i
at
at
=
commit
.
committed_date
.
strftime
(
"%Y-%m-%d %H:%M:%S"
)
=
commit
[
:timestamp
].
to_time
.
to_s
(
:short
)
%blockquote
=
simple_format
(
escape_once
(
commit
.
safe_message
))
%blockquote
=
simple_format
(
escape_once
(
commit
[
:message
]
))
-
if
event
.
commits_count
>
15
-
if
event
.
commits_count
>
15
%p
%p
%i
%i
...
...
app/views/events/event/_push.html.haml
View file @
ff4471a3
...
@@ -21,5 +21,5 @@
...
@@ -21,5 +21,5 @@
%li
.commits-stat
%li
.commits-stat
-
if
event
.
commits_count
>
2
-
if
event
.
commits_count
>
2
%span
... and
#{
event
.
commits_count
-
2
}
more commits.
%span
... and
#{
event
.
commits_count
-
2
}
more commits.
=
link_to
project_compare_path
(
event
.
project
,
from:
event
.
parent_commit
.
id
,
to:
event
.
last_commit
.
id
)
do
=
link_to
project_compare_path
(
event
.
project
,
from:
event
.
commit_from
,
to:
event
.
commit_to
)
do
%strong
Compare
→
#{
event
.
parent_commit
.
id
[
0
..
7
]
}
...
#{
event
.
last_commit
.
id
[
0
..
7
]
}
%strong
Compare
→
#{
event
.
commit_from
[
0
..
7
]
}
...
#{
event
.
commit_to
[
0
..
7
]
}
app/views/groups/show.atom.builder
View file @
ff4471a3
...
@@ -8,7 +8,6 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://sear
...
@@ -8,7 +8,6 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://sear
@events.each do |event|
@events.each do |event|
if event.proper?
if event.proper?
event = EventDecorator.decorate(event)
xml.entry do
xml.entry do
event_link = event.feed_url
event_link = event.feed_url
event_title = event.feed_title
event_title = event.feed_title
...
...
app/views/teams/show.atom.builder
View file @
ff4471a3
...
@@ -8,7 +8,6 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://sear
...
@@ -8,7 +8,6 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://sear
@events.each do |event|
@events.each do |event|
if event.proper?
if event.proper?
event = EventDecorator.decorate(event)
xml.entry do
xml.entry do
event_link = event.feed_url
event_link = event.feed_url
event_title = event.feed_title
event_title = event.feed_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