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
f943156b
Commit
f943156b
authored
Mar 04, 2016
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Put 'hidden commits' logic in CommitsHelper
parent
5eeea4b7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
12 deletions
+23
-12
app/helpers/commits_helper.rb
app/helpers/commits_helper.rb
+12
-0
app/views/projects/commits/_commit_list.html.haml
app/views/projects/commits/_commit_list.html.haml
+7
-4
app/views/projects/commits/_commits.html.haml
app/views/projects/commits/_commits.html.haml
+4
-8
No files found.
app/helpers/commits_helper.rb
View file @
f943156b
...
...
@@ -211,4 +211,16 @@ module CommitsHelper
def
clean
(
string
)
Sanitize
.
clean
(
string
,
remove_contents:
true
)
end
def
limited_commits
(
commits
)
if
commits
.
size
>
MergeRequestDiff
::
COMMITS_SAFE_SIZE
# Not 100% sure we need to decorate but it is idempotent and not so slow
[
commits
.
first
(
MergeRequestDiff
::
COMMITS_SAFE_SIZE
),
commits
.
size
-
MergeRequestDiff
::
COMMITS_SAFE_SIZE
]
else
[
commits
,
0
]
end
end
end
app/views/projects/commits/_commit_list.html.haml
View file @
f943156b
-
commits
,
hidden
=
limited_commits
(
@commits
,
@project
)
-
commits
=
Commit
.
decorate
(
commits
,
@project
)
%div
.panel.panel-default
.panel-heading
Commits (
#{
@commits
.
count
}
)
-
if
@commits
.
size
>
MergeRequestDiff
::
COMMITS_SAFE_SIZE
-
if
hidden
>
0
%ul
.well-list
-
Commit
.
decorate
(
@commits
.
first
(
MergeRequestDiff
::
COMMITS_SAFE_SIZE
),
@project
)
.
each
do
|
commit
|
-
commits
.
each
do
|
commit
|
=
render
"projects/commits/inline_commit"
,
commit:
commit
,
project:
@project
%li
.warning-row.unstyled
other
#{
@commits
.
size
-
MergeRequestDiff
::
COMMITS_SAFE_SIZE
}
commits hidden to prevent performance issues.
other
#{
hidden
}
commits hidden to prevent performance issues.
-
else
%ul
.well-list
=
render
Commit
.
decorate
(
@commits
,
@project
)
,
project:
@project
%ul
.well-list
=
render
commits
,
project:
@project
app/views/projects/commits/_commits.html.haml
View file @
f943156b
-
unless
defined?
(
project
)
-
project
=
@project
-
if
@commits
.
size
>
MergeRequestDiff
::
COMMITS_SAFE_SIZE
-
commits
=
@commits
.
first
(
MergeRequestDiff
::
COMMITS_SAFE_SIZE
)
-
overflow
=
true
-
else
-
commits
=
@commits
-
overflow
=
false
-
commits
,
hidden
=
limited_commits
(
@commits
)
-
commits
.
group_by
{
|
c
|
c
.
committed_date
.
to_date
}.
sort
.
reverse
.
each
do
|
day
,
commits
|
.row.commits-row
...
...
@@ -20,6 +16,6 @@
=
render
commits
,
project:
project
%hr
.lists-separator
-
if
overflow
-
if
hidden
>
0
.alert.alert-warning
Not shown:
#{
@commits
.
size
-
MergeRequestDiff
::
COMMITS_SAFE_SIZE
}
more commits
Not shown:
#{
hidden
}
more commits
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