]> source.dussan.org Git - gitea.git/commitdiff
Make compare button URL aware if current repo is a fork (#2162) (#2163)
authorWiktor Żurawik <wiktor.zurawik@gmail.com>
Sat, 15 Jul 2017 03:14:02 +0000 (05:14 +0200)
committerLunny Xiao <xiaolunwen@gmail.com>
Sat, 15 Jul 2017 03:14:02 +0000 (11:14 +0800)
* Make compare button URL aware if current repo is a fork (#2162)

* Optimize code

* To not change current behaviour check if signed in user has fork of base repository

* Fix to check only if signed user has forked repo otherwise it will still redirect to wrong page

templates/repo/home.tmpl

index a87e6b7588282041be053db2963f78fb48dbdb06..664326c56209e6780b440bb7ca01bd1adbf7ef60 100644 (file)
@@ -10,7 +10,7 @@
                <div class="ui secondary menu">
                        {{if .PullRequestCtx.Allowed}}
                                <div class="fitted item">
-                                       <a href="{{.BaseRepo.Link}}/compare/{{.BaseRepo.DefaultBranch}}...{{.SignedUser.Name}}:{{.BranchName}}">
+                                       <a href="{{.BaseRepo.Link}}/compare/{{.BaseRepo.DefaultBranch}}...{{if .SignedUser.HasForkedRepo .BaseRepo.ID }}{{.SignedUser.Name}}:{{end}}{{.BranchName}}">
                                                <button class="ui green small button"><i class="octicon octicon-git-compare"></i></button>
                                        </a>
                                </div>