diff options
author | Alec Warner <antarus@gentoo.org> | 2023-01-03 10:36:37 -0800 |
---|---|---|
committer | Alec Warner <antarus@gentoo.org> | 2023-01-03 10:51:09 -0800 |
commit | 66b6c4ae3bef7d8bffe61f84e4fbbc96342398ba (patch) | |
tree | 43b23fbf254eb47ce91f741fa227323ad6e7be54 /web | |
parent | Dockerfiles: update golang images (diff) | |
download | soko-66b6c4ae3bef7d8bffe61f84e4fbbc96342398ba.tar.gz soko-66b6c4ae3bef7d8bffe61f84e4fbbc96342398ba.tar.bz2 soko-66b6c4ae3bef7d8bffe61f84e4fbbc96342398ba.zip |
Use whitespace eliding to avoid generating a large response.
Previously for changelogs with large changes in them like commit
38b155fa1bf907617067c98eb4ba3a5d0790eb1a, we would emit thousands of
newlines in the response.
Hopefully, this change (tested in golang playground) will result in
better performance and make our CDN happy.
Signed-off-by: Alec Warner <antarus@gentoo.org>
Diffstat (limited to 'web')
-rw-r--r-- | web/templates/packages/changelog/changelog.tmpl | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/web/templates/packages/changelog/changelog.tmpl b/web/templates/packages/changelog/changelog.tmpl index 261e1ed..ad0b2a9 100644 --- a/web/templates/packages/changelog/changelog.tmpl +++ b/web/templates/packages/changelog/changelog.tmpl @@ -27,7 +27,7 @@ <div class="col-md-12"> {{$commit := .}} {{range $key, $value := .ChangedFiles.Added }} - {{if le $key 100}} + {{-if le $key 100 -}} {{ if contains .Path (print $.Atom "/")}} <style> .kk-added-file-badge { @@ -43,7 +43,7 @@ {{end}} {{end}} {{range $key, $value := .ChangedFiles.Modified }} - {{if le $key 100}} + {{- if le $key 100 -}} {{ if contains $value.Path (print $.Atom "/")}} <style> .kk-modified-file-badge { @@ -59,7 +59,7 @@ {{end}} {{end}} {{range $key, $value := .ChangedFiles.Deleted }} - {{if le $key 100}} + {{- if le $key 100 -}} {{ if contains .Path (print $.Atom "/")}} <style> .kk-deleted-file-badge { @@ -104,7 +104,7 @@ <div class="col-md-12"> {{$commit := .}} {{range $key, $value := .ChangedFiles.Added }} - {{if le $key 50}} + {{- if le $key 50 -}} {{ if contains $value.Path (print $.Atom "/")}} <style> .kk-added-file-badge { @@ -120,7 +120,7 @@ {{end}} {{end}} {{range $key, $value := .ChangedFiles.Modified }} - {{if le $key 50}} + {{- if le $key 50 -}} {{ if contains $value.Path (print $.Atom "/")}} <style> .kk-modified-file-badge { @@ -135,8 +135,9 @@ {{end}} {{end}} {{end}} - {{range .ChangedFiles.Deleted }} - {{ if contains .Path (print $.Atom "/")}} + {{range $key, $value := .ChangedFiles.Deleted }} + {{- if le $key 50 -}} + {{ if contains .Path (print $.Atom "/")}} <style> .kk-deleted-file-badge { background-color: #f2dede; @@ -147,6 +148,7 @@ } </style> <span class="badge badge-pill kk-deleted-file-badge badge-light"><a title="{{replaceall .Path (print $.Atom "/") ""}} has been deleted" class="text-muted" href="https://gitweb.gentoo.org/repo/gentoo.git/diff/{{ $.Atom }}/{{replaceall .Path (print $.Atom "/") ""}}?id={{ $commit.Id }}">{{replaceall .Path (print $.Atom "/") ""}}</a></span> + {{end}} {{end}} {{end}} </div> |