Only show comparison link for >2 commits #1110

We can look at the PushCommits object to see how many commits were
included in a commit, and add some template logic to only show the
comparison link when there are at least 2 commits in a push. We also
correct the link to display the number of commits.
This commit is contained in:
Angus Gibson 2015-12-09 14:36:39 +11:00
parent 120cd4e471
commit 06d293a84e
16 changed files with 724 additions and 941 deletions

View File

@ -1018,7 +1018,7 @@ comment_issue=`коментира проблем <a href="%s/issues/%s">%s#%[2]s
merge_pull_request=`обедини заявка за сливане <a href="%s/pulls/%s">%s#%[2]s</a>`
transfer_repo=прехвърли хранилище <code>%s</code> към <a href="%s">%s</a>
push_tag=предаде маркер <a href="%s/src/%s">%[2]s</a> към <a href="%[1]s">[3]s</a>
compare_2_commits=Сравнение между тези 2 ревизии
compare_commits=Сравнение между тези %d ревизии
[tool]
ago=преди

View File

@ -1018,7 +1018,7 @@ comment_issue=`hat Issue <a href="%s/issues/%s">%s#%[2]s</a> kommentiert`
merge_pull_request=`Pull-Request <a href="%s/pulls/%s">%s#%[2]s</a> zuammengeführt`
transfer_repo=hat Repository <code>%s</code> transferiert an <a href="%s">%s</a>
push_tag=hat nach <a href="%s/src/%s">%[2]s</a> in <a href="%[1]s">%[3]s</a> gepusht
compare_2_commits=Zeige Vergleich dieser 2 Commits
compare_commits=Zeige Vergleich dieser %d Commits
[tool]
ago=vor

View File

@ -1021,7 +1021,7 @@ comment_issue = `commented on issue <a href="%s/issues/%s">%s#%[2]s</a>`
merge_pull_request = `merged pull request <a href="%s/pulls/%s">%s#%[2]s</a>`
transfer_repo = transfered repository <code>%s</code> to <a href="%s">%s</a>
push_tag = pushed tag <a href="%s/src/%s">%[2]s</a> to <a href="%[1]s">%[3]s</a>
compare_2_commits = View comparison for these 2 commits
compare_commits = View comparison for these %d commits
[tool]
ago = ago

View File

@ -1018,7 +1018,7 @@ comment_issue=`comentó en la incidencia <a href="%s/issues/%s">%s#%[2]s</a>`
merge_pull_request=`fusionado pull request <a href="%s/pulls/%s">%s#%[2]s</a>`
transfer_repo=transfirió el repositorio <code>%s</code> a <a href="%s">%s</a>
push_tag=hizo push del tag <a href="%s/src/%s">%[2]s</a> a <a href="%[1]s">%[3]s</a>
compare_2_commits=Ver la comparación de estos 2 commits
compare_commits=Ver la comparación de estos %d commits
[tool]
ago=hace

View File

@ -1018,7 +1018,7 @@ comment_issue=`a commenté le problème <a href="%s/issues/%s">%s#%[2]s</a>`
merge_pull_request=`pull request fusionné le <a href="%s/pulls/%s">%s#%[2]s</a>`
transfer_repo=a transféré le dépôt <code>%s</code> à <a href="%s">%s</a>
push_tag=a soumis le tag <a href="%s/src/%s">%[2]s</a> à <a href="%[1]s">%[3]s</a>
compare_2_commits=Comparer ces 2 commits
compare_commits=Comparer ces %d commits
[tool]
ago=auparavant

View File

@ -1018,7 +1018,7 @@ comment_issue=`ha commentato il problema <a href="%s/issues/%s">%s#%[2]s</a>`
merge_pull_request=`merged pull request <a href="%s/pulls/%s">%s#%[2]s</a>`
transfer_repo=ha trasferito il repository <code>%s</code> a <a href="%s">%s</a>
push_tag=ha pushato il tag <a href="%s/src/%s">%[2]s</a> a <a href="%[1]s">%[3]s</a>
compare_2_commits=Vedi confronto per questi 2 commit
compare_commits=Vedi confronto per questi %d commit
[tool]
ago=fa

View File

@ -1018,7 +1018,7 @@ comment_issue=`問題 <a href="%s/issues/%s">%s#%[2]s</a> のコメント`
merge_pull_request=`プルリクエスト <a href="%s/pulls/%s"> %s[2]s</a>をマージしました`
transfer_repo=リポジトリ <code>%s</code> を <a href="%s">%s</a> へ転送しました
push_tag=<a href="%[1]s">%[3]s</a> に タグ <a href="%[1]s/src/%[2]s">%[2]s</a> をプッシュしました
compare_2_commits=これら 2 のコミットの比較を閲覧する
compare_commits=これら %d のコミットの比較を閲覧する
[tool]
ago=

View File

@ -1018,7 +1018,7 @@ comment_issue=`pievienoja komentāru problēmai <a href="%s/issues/%s">%s#%[2]s<
merge_pull_request=`sapludināja izmaiņu pieprasījumu <a href="%s/pulls/%s">%s#%[2]s</a>`
transfer_repo=mainīja repozitorija <code>%s</code> īpašnieku uz <a href="%s">%s</a>
push_tag=pievienoja tagu <a href="%s/src/%s">%[2]s</a> repozitorijam <a href="%[1]s">%[3]s</a>
compare_2_commits=Veikt salīdzināšanu starp šīm 2 revīzijām
compare_commits=Veikt salīdzināšanu starp šīm %d revīzijām
[tool]
ago=atpakaļ

View File

@ -1018,7 +1018,7 @@ comment_issue=`reactie op issue <a href="%s/issues/%s">%s#%[2]s</a>`
merge_pull_request=`merged pull request <a href="%s/pulls/%s">%s#%[2]s</a>`
transfer_repo=repositorie verplaatst naar <code>%s</code> naar <a href="%s">%s</a>
push_tag=geduwd label <a href="%s/src/%s"> %[2]s</a> naar <a href="%[1]s"> %[3]s</a>
compare_2_commits=Weergave vergelijking voor deze 2 commits
compare_commits=Weergave vergelijking voor deze %d commits
[tool]
ago=geleden

View File

@ -1018,7 +1018,7 @@ comment_issue=`skomentował problem <a href="%s/issues/%s">#%[2]s %[3]s</a>`
merge_pull_request=scalił pull request <a href="%s/pulls/%s"> %s #%[2]s"</a>
transfer_repo=przeniósł repozytorium <code>%s</code> do <a href="%s">%s</a>
push_tag=opublikował tag <a href="%s/src/%s">%[2]s</a> w <a href="%[1]s">%[3]s</a>
compare_2_commits=Zobacz porównanie tych 2 commitów
compare_commits=Zobacz porównanie tych %d commitów
[tool]
ago=temu

View File

@ -1018,7 +1018,7 @@ comment_issue='comentou sobre a questão <a href="%s/issues/%s">%s#%[2]s</a>'
merge_pull_request=`mesclou o pull request <a href="%s/pulls/%s">%s#%[2]s</a>`
transfer_repo=repositório transferido de <code>%s</code> para <a href="%s">%s</a>
push_tag=Foi feito push na tag <a href="%s/src/%s">%[2]s</a> para <a href="%[1]s">%[3]s</a>
compare_2_commits=Ver comparação desses 2 commits
compare_commits=Ver comparação desses %d commits
[tool]
ago=atrás

View File

@ -1018,7 +1018,7 @@ comment_issue=`прокомментировал(а) вопрос <a href="%s/iss
merge_pull_request=`слил пул реквест <a href="%s/pulls/%s">%s#%[2]s</a>`
transfer_repo=перенес репозиторий <code>%s</code> в <a href="%s">%s</a>
push_tag=запушил тэг <a href="%s/src/%s">%[2]s</a> в <a href="%[1]s">%[3]s</a>
compare_2_commits=Просмотреть сравнение двух коммитов
compare_commits=Просмотреть сравнение %d коммитов
[tool]
ago=назад

View File

@ -1018,7 +1018,7 @@ comment_issue=`评论了工单 <a href="%s/issues/%s">%s#%[2]s</a>`
merge_pull_request=`合并了合并请求 <a href="%s/pulls/%s">%s#%[2]s</a>`
transfer_repo=将仓库 <code>%s</code> 转移至 <a href="%s">%s</a>
push_tag=推送了标签 <a href="%s/src/%s">%[2]s</a> 到 <a href="%[1]s">%[3]s</a>
compare_2_commits=查看 2 次提交的内容对比
compare_commits=查看 %d 次提交的内容对比
[tool]
ago=之前

View File

@ -1018,7 +1018,7 @@ comment_issue=`評論了問題 <a href="%s/issues/%s">%s#%[2]s</a>`
merge_pull_request=`merged pull request <a href="%s/pulls/%s">%s#%[2]s</a>`
transfer_repo=將倉庫 <code>%s</code> 轉移至 <a href="%s">%s</a>
push_tag=推送了標籤 <a href="%s/src/%s">%[2]s</a> 到 <a href="%[1]s">%[3]s</a>
compare_2_commits=查看 2 次提交的內容對比
compare_commits=查看 %d 次提交的內容對比
[tool]
ago=之前

File diff suppressed because one or more lines are too long

View File

@ -43,7 +43,7 @@
<li><img class="img-8" src="{{$push.AvatarLink .AuthorEmail}}"> <a href="{{$repoLink}}/commit/{{.Sha1}}">{{ShortSha .Sha1}}</a> <span class="text truncate light grey">{{.Message}}</span></li>
{{end}}
{{end}}
{{if $push.CompareUrl}}<li><a href="{{AppSubUrl}}/{{$push.CompareUrl}}">{{$.i18n.Tr "action.compare_2_commits"}} »</a></li>{{end}}
{{if and (gt $push.Len 1) $push.CompareUrl}}<li><a href="{{AppSubUrl}}/{{$push.CompareUrl}}">{{$.i18n.Tr "action.compare_commits" $push.Len}} »</a></li>{{end}}
</ul>
</div>
{{else if eq .GetOpType 6}}