summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorLauris BH <lauris@nix.lv>2017-10-15 18:06:07 +0300
committerGitHub <noreply@github.com>2017-10-15 18:06:07 +0300
commit1ec4dc6c1dec3814d8956bcd1157a51bfe53eb0e (patch)
tree742d82bceac48af7f5088be3c70bdb6d000728ea /templates
parent32ca299650277829b93994eca1508f9d84a5b667 (diff)
downloadgitea-1ec4dc6c1dec3814d8956bcd1157a51bfe53eb0e.tar.gz
gitea-1ec4dc6c1dec3814d8956bcd1157a51bfe53eb0e.zip
Fix so that user can still fork his own repository to owned organizations (#2699)
* Fix so that user can still fork his own repository to his organizations * Fix to only use owned organizations * Add integration test for forking own repository to owned organization
Diffstat (limited to 'templates')
-rw-r--r--templates/repo/header.tmpl2
-rw-r--r--templates/repo/pulls/fork.tmpl20
2 files changed, 11 insertions, 11 deletions
diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl
index 6baacd537b..ee6fcb388d 100644
--- a/templates/repo/header.tmpl
+++ b/templates/repo/header.tmpl
@@ -32,7 +32,7 @@
</div>
{{if .CanBeForked}}
<div class="ui compact labeled button" tabindex="0">
- <a class="ui compact button {{if eq .OwnerID $.SignedUserID}}poping up{{end}}" {{if not (eq .OwnerID $.SignedUserID)}}href="{{AppSubUrl}}/repo/fork/{{.ID}}"{{else}} data-content="{{$.i18n.Tr "repo.fork_from_self"}}" data-position="top center" data-variation="tiny"{{end}}>
+ <a class="ui compact button {{if not $.CanSignedUserFork}}poping up{{end}}" {{if $.CanSignedUserFork}}href="{{AppSubUrl}}/repo/fork/{{.ID}}"{{else}} data-content="{{$.i18n.Tr "repo.fork_from_self"}}" data-position="top center" data-variation="tiny"{{end}}>
<i class="octicon octicon-repo-forked"></i>{{$.i18n.Tr "repo.fork"}}
</a>
<a class="ui basic label" href="{{.Link}}/forks">
diff --git a/templates/repo/pulls/fork.tmpl b/templates/repo/pulls/fork.tmpl
index 133cc92f7c..e9fbfdf2b6 100644
--- a/templates/repo/pulls/fork.tmpl
+++ b/templates/repo/pulls/fork.tmpl
@@ -19,17 +19,17 @@
</span>
<i class="dropdown icon"></i>
<div class="menu">
- <div class="item" data-value="{{.SignedUser.ID}}">
- <img class="ui mini image" src="{{.SignedUser.RelAvatarLink}}">
- {{.SignedUser.ShortName 20}}
- </div>
+ {{if .CanForkToUser}}
+ <div class="item" data-value="{{.SignedUser.ID}}">
+ <img class="ui mini image" src="{{.SignedUser.RelAvatarLink}}">
+ {{.SignedUser.ShortName 20}}
+ </div>
+ {{end}}
{{range .Orgs}}
- {{if and (.IsOwnedBy $.SignedUser.ID) (ne .ID $.ForkFromOwnerID)}}
- <div class="item" data-value="{{.ID}}">
- <img class="ui mini image" src="{{.RelAvatarLink}}">
- {{.ShortName 20}}
- </div>
- {{end}}
+ <div class="item" data-value="{{.ID}}">
+ <img class="ui mini image" src="{{.RelAvatarLink}}">
+ {{.ShortName 20}}
+ </div>
{{end}}
</div>
</div>