mirror of
https://github.com/go-gitea/gitea.git
synced 2025-06-23 06:28:01 +02:00
Restrict permission check on repositories and fix some problems (#5314)
* fix units permission problems * fix some bugs and merge LoadUnits to repoAssignment * refactor permission struct and add some copyright heads * remove unused codes * fix routes units check * improve permission check * add unit tests for permission * fix typo * fix tests * fix some routes * fix api permission check * improve permission check * fix some permission check * fix tests * fix tests * improve some permission check * fix some permission check * refactor AccessLevel * fix bug * fix tests * fix tests * fix tests * fix AccessLevel * rename CanAccess * fix tests * fix comment * fix bug * add missing unit for test repos * fix bug * rename some functions * fix routes check
This commit is contained in:
@ -23,10 +23,10 @@
|
||||
</h2>
|
||||
<div class="ui divider"></div>
|
||||
|
||||
{{if (or (.Repository.UnitEnabled $.UnitTypeIssues) (.Repository.UnitEnabled $.UnitTypePullRequests))}}
|
||||
{{if (or (.Permission.CanRead $.UnitTypeIssues) (.Permission.CanRead $.UnitTypePullRequests))}}
|
||||
<h4 class="ui top attached header">{{.i18n.Tr "repo.activity.overview"}}</h4>
|
||||
<div class="ui attached segment two column grid">
|
||||
{{if .Repository.UnitEnabled $.UnitTypePullRequests}}
|
||||
{{if .Permission.CanRead $.UnitTypePullRequests}}
|
||||
<div class="column">
|
||||
{{if gt .Activity.ActivePRCount 0}}
|
||||
<div class="stats-table">
|
||||
@ -41,7 +41,7 @@
|
||||
{{.i18n.Tr (TrN .i18n.Lang .Activity.ActivePRCount "repo.activity.active_prs_count_1" "repo.activity.active_prs_count_n") .Activity.ActivePRCount | Safe }}
|
||||
</div>
|
||||
{{end}}
|
||||
{{if .Repository.UnitEnabled $.UnitTypeIssues}}
|
||||
{{if .Permission.CanRead $.UnitTypeIssues}}
|
||||
<div class="column">
|
||||
{{if gt .Activity.ActiveIssueCount 0}}
|
||||
<div class="stats-table">
|
||||
@ -58,7 +58,7 @@
|
||||
{{end}}
|
||||
</div>
|
||||
<div class="ui attached segment horizontal segments">
|
||||
{{if .Repository.UnitEnabled $.UnitTypePullRequests}}
|
||||
{{if .Permission.CanRead $.UnitTypePullRequests}}
|
||||
<a href="#merged-pull-requests" class="ui attached segment text center">
|
||||
<i class="text purple octicon octicon-git-pull-request"></i> <strong>{{.Activity.MergedPRCount}}</strong><br>
|
||||
{{.i18n.Tr (TrN .i18n.Lang .Activity.MergedPRCount "repo.activity.merged_prs_count_1" "repo.activity.merged_prs_count_n") }}
|
||||
@ -68,7 +68,7 @@
|
||||
{{.i18n.Tr (TrN .i18n.Lang .Activity.OpenedPRCount "repo.activity.opened_prs_count_1" "repo.activity.opened_prs_count_n") }}
|
||||
</a>
|
||||
{{end}}
|
||||
{{if .Repository.UnitEnabled $.UnitTypeIssues}}
|
||||
{{if .Permission.CanRead $.UnitTypeIssues}}
|
||||
<a href="#closed-issues" class="ui attached segment text center">
|
||||
<i class="text red octicon octicon-issue-closed"></i> <strong>{{.Activity.ClosedIssueCount}}</strong><br>
|
||||
{{.i18n.Tr (TrN .i18n.Lang .Activity.ClosedIssueCount "repo.activity.closed_issues_count_1" "repo.activity.closed_issues_count_n") }}
|
||||
|
@ -5,7 +5,7 @@
|
||||
<div class="ui grid">
|
||||
<div class="sixteen wide column content">
|
||||
{{template "base/alert" .}}
|
||||
{{if .IsRepositoryWriter}}
|
||||
{{if .CanWriteCode}}
|
||||
<h4 class="ui top attached header">
|
||||
{{.i18n.Tr "repo.quick_guide"}}
|
||||
</h4>
|
||||
|
@ -21,7 +21,7 @@
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.root.RepoLink .ID) }}
|
||||
{{if or $.root.IsRepositoryAdmin (eq .Poster.ID $.root.SignedUserID)}}
|
||||
{{if or $.root.Permission.IsAdmin (eq .Poster.ID $.root.SignedUserID)}}
|
||||
<div class="item action">
|
||||
<a class="edit-content" href="#"><i class="octicon octicon-pencil"></i></a>
|
||||
<a class="delete-comment" href="#" data-comment-id={{.HashTag}} data-url="{{$.root.RepoLink}}/comments/{{.ID}}/delete" data-locale="{{$.root.i18n.Tr "repo.issues.delete_comment_confirm"}}"><i class="octicon octicon-x"></i></a>
|
||||
|
@ -30,7 +30,7 @@
|
||||
{{.NumStars}}
|
||||
</a>
|
||||
</div>
|
||||
{{if .CanBeForked}}
|
||||
{{if and (not .IsBare) ($.Permission.CanRead $.UnitTypeCode)}}
|
||||
<div class="ui compact labeled button" tabindex="0">
|
||||
<a class="ui compact button {{if not $.CanSignedUserFork}}poping up{{end}}" {{if $.CanSignedUserFork}}href="{{AppSubUrl}}/repo/fork/{{.ID}}"{{else if $.IsSigned}} 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"}}
|
||||
@ -47,43 +47,43 @@
|
||||
{{if not .IsDiffCompare}}
|
||||
<div class="ui tabs container">
|
||||
<div class="ui tabular stackable menu navbar">
|
||||
{{if .Repository.UnitEnabled $.UnitTypeCode}}
|
||||
{{if .Permission.CanRead $.UnitTypeCode}}
|
||||
<a class="{{if .PageIsViewCode}}active{{end}} item" href="{{.RepoLink}}{{if (ne .BranchName .Repository.DefaultBranch)}}/src/{{.BranchNameSubURL | EscapePound}}{{end}}">
|
||||
<i class="octicon octicon-code"></i> {{.i18n.Tr "repo.code"}}
|
||||
</a>
|
||||
{{end}}
|
||||
|
||||
{{if .Repository.UnitEnabled $.UnitTypeIssues}}
|
||||
{{if .Permission.CanRead $.UnitTypeIssues}}
|
||||
<a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoLink}}/issues">
|
||||
<i class="octicon octicon-issue-opened"></i> {{.i18n.Tr "repo.issues"}} <span class="ui {{if not .Repository.NumOpenIssues}}gray{{else}}blue{{end}} small label">{{.Repository.NumOpenIssues}}</span>
|
||||
</a>
|
||||
{{end}}
|
||||
|
||||
{{if .Repository.UnitEnabled $.UnitTypeExternalTracker}}
|
||||
{{if .Permission.CanRead $.UnitTypeExternalTracker}}
|
||||
<a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoLink}}/issues" target="_blank" rel="noopener noreferrer">
|
||||
<i class="octicon octicon-issue-opened"></i> {{.i18n.Tr "repo.issues"}} </span>
|
||||
</a>
|
||||
{{end}}
|
||||
|
||||
{{if .Repository.AllowsPulls}}
|
||||
{{if and .Repository.CanEnablePulls (.Permission.CanRead $.UnitTypePullRequests)}}
|
||||
<a class="{{if .PageIsPullList}}active{{end}} item" href="{{.RepoLink}}/pulls">
|
||||
<i class="octicon octicon-git-pull-request"></i> {{.i18n.Tr "repo.pulls"}} <span class="ui {{if not .Repository.NumOpenPulls}}gray{{else}}blue{{end}} small label">{{.Repository.NumOpenPulls}}</span>
|
||||
</a>
|
||||
{{end}}
|
||||
|
||||
{{if and (.Repository.UnitEnabled $.UnitTypeReleases) (not .IsBareRepo) }}
|
||||
{{if and (.Permission.CanRead $.UnitTypeReleases) (not .IsBareRepo) }}
|
||||
<a class="{{if .PageIsReleaseList}}active{{end}} item" href="{{.RepoLink}}/releases">
|
||||
<i class="octicon octicon-tag"></i> {{.i18n.Tr "repo.releases"}} <span class="ui {{if not .Repository.NumReleases}}gray{{else}}blue{{end}} small label">{{.Repository.NumReleases}}</span>
|
||||
</a>
|
||||
{{end}}
|
||||
|
||||
{{if or (.Repository.UnitEnabled $.UnitTypeWiki) (.Repository.UnitEnabled $.UnitTypeExternalWiki)}}
|
||||
<a class="{{if .PageIsWiki}}active{{end}} item" href="{{.RepoLink}}/wiki" {{if (.Repository.UnitEnabled $.UnitTypeExternalWiki)}} target="_blank" rel="noopener noreferrer" {{end}}>
|
||||
{{if or (.Permission.CanRead $.UnitTypeWiki) (.Permission.CanRead $.UnitTypeExternalWiki)}}
|
||||
<a class="{{if .PageIsWiki}}active{{end}} item" href="{{.RepoLink}}/wiki" {{if (.Permission.CanRead $.UnitTypeExternalWiki)}} target="_blank" rel="noopener noreferrer" {{end}}>
|
||||
<i class="octicon octicon-book"></i> {{.i18n.Tr "repo.wiki"}}
|
||||
</a>
|
||||
{{end}}
|
||||
|
||||
{{if and (.Repository.AnyUnitEnabled $.UnitTypePullRequests $.UnitTypeIssues $.UnitTypeReleases) (not .IsBareRepo)}}
|
||||
{{if and (.Permission.CanReadAny $.UnitTypePullRequests $.UnitTypeIssues $.UnitTypeReleases) (not .IsBareRepo)}}
|
||||
<a class="{{if .PageIsActivity}}active{{end}} item" href="{{.RepoLink}}/activity">
|
||||
<i class="octicon octicon-pulse"></i> {{.i18n.Tr "repo.activity"}}
|
||||
</a>
|
||||
@ -91,7 +91,7 @@
|
||||
|
||||
{{template "custom/extra_tabs" .}}
|
||||
|
||||
{{if .IsRepositoryAdmin}}
|
||||
{{if .Permission.IsAdmin}}
|
||||
<div class="right menu">
|
||||
<a class="{{if .PageIsSettings}}active{{end}} item" href="{{.RepoLink}}/settings">
|
||||
<i class="octicon octicon-tools"></i> {{.i18n.Tr "repo.settings"}}
|
||||
|
@ -25,9 +25,9 @@
|
||||
</div>
|
||||
<div class="ui repo-topic" id="repo-topic">
|
||||
{{range .Topics}}<a class="ui green basic label topic" style="cursor:pointer;" href="{{AppSubUrl}}/explore/repos?q={{.Name}}&topic=1">{{.Name}}</a>{{end}}
|
||||
{{if .IsRepositoryAdmin}}<a id="manage_topic" style="cursor:pointer;margin-left:10px;">{{.i18n.Tr "repo.topic.manage_topics"}}</a>{{end}}
|
||||
{{if .Permission.IsAdmin}}<a id="manage_topic" style="cursor:pointer;margin-left:10px;">{{.i18n.Tr "repo.topic.manage_topics"}}</a>{{end}}
|
||||
</div>
|
||||
{{if .IsRepositoryAdmin}}
|
||||
{{if .Permission.IsAdmin}}
|
||||
<div class="ui repo-topic-edit grid form segment error" id="topic_edit" style="display:none">
|
||||
<div class="fourteen wide column">
|
||||
<div class="field">
|
||||
|
@ -4,7 +4,7 @@
|
||||
<div class="ui container">
|
||||
<div class="navbar">
|
||||
{{template "repo/issue/navbar" .}}
|
||||
{{if .IsRepositoryWriter}}
|
||||
{{if or .CanWriteIssues .CanWritePulls}}
|
||||
<div class="ui right">
|
||||
<div class="ui green new-label button">{{.i18n.Tr "repo.issues.new_label"}}</div>
|
||||
</div>
|
||||
@ -57,7 +57,7 @@
|
||||
{{template "base/alert" .}}
|
||||
<div class="ui black label">{{.i18n.Tr "repo.issues.label_count" .NumLabels}}</div>
|
||||
<div class="label list">
|
||||
{{if and $.IsRepositoryWriter (eq .NumLabels 0)}}
|
||||
{{if and (or $.CanWriteIssues $.CanWritePulls) (eq .NumLabels 0)}}
|
||||
<div class="ui centered grid">
|
||||
<div class="twelve wide column eight wide computer column">
|
||||
<div class="ui attached left aligned segment">
|
||||
@ -105,7 +105,7 @@
|
||||
<a class="ui right open-issues" href="{{$.RepoLink}}/issues?labels={{.ID}}"><i class="octicon octicon-issue-opened"></i> {{$.i18n.Tr "repo.issues.label_open_issues" .NumOpenIssues}}</a>
|
||||
</div>
|
||||
<div class="three wide column">
|
||||
{{if $.IsRepositoryWriter}}
|
||||
{{if or $.CanWriteIssues $.CanWritePulls}}
|
||||
<a class="ui right delete-button" href="#" data-url="{{$.RepoLink}}/labels/delete" data-id="{{.ID}}"><i class="octicon octicon-trashcan"></i> {{$.i18n.Tr "repo.issues.label_delete"}}</a>
|
||||
<a class="ui right edit-label-button" href="#" data-id="{{.ID}}" data-title="{{.Name}}" data-description="{{.Description}}" data-color={{.Color}}><i class="octicon octicon-pencil"></i> {{$.i18n.Tr "repo.issues.label_edit"}}</a>
|
||||
{{end}}
|
||||
@ -117,7 +117,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{if .IsRepositoryWriter}}
|
||||
{{if or $.CanWriteIssues $.CanWritePulls}}
|
||||
<div class="ui small basic delete modal">
|
||||
<div class="ui icon header">
|
||||
<i class="trash icon"></i>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<div class="ui container">
|
||||
<div class="navbar">
|
||||
{{template "repo/issue/navbar" .}}
|
||||
{{if and .IsRepositoryWriter .PageIsEditMilestone}}
|
||||
{{if and (or .CanWriteIssues .CanWritePulls) .PageIsEditMilestone}}
|
||||
<div class="ui right floated secondary menu">
|
||||
<a class="ui green button" href="{{$.RepoLink}}/milestones/new">{{.i18n.Tr "repo.milestones.new"}}</a>
|
||||
</div>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<div class="ui container">
|
||||
<div class="navbar">
|
||||
{{template "repo/issue/navbar" .}}
|
||||
{{if .IsRepositoryWriter}}
|
||||
{{if or .CanWriteIssues .CanWritePulls}}
|
||||
<div class="ui right">
|
||||
<a class="ui green button" href="{{$.Link}}/new">{{.i18n.Tr "repo.milestones.new"}}</a>
|
||||
</div>
|
||||
@ -67,7 +67,7 @@
|
||||
{{if .TotalTrackedTime}}<i class="octicon octicon-clock"></i> {{.TotalTrackedTime|Sec2Time}}{{end}}
|
||||
</span>
|
||||
</div>
|
||||
{{if $.IsRepositoryWriter}}
|
||||
{{if or $.CanWriteIssues $.CanWritePulls}}
|
||||
<div class="ui right operate">
|
||||
<a href="{{$.Link}}/{{.ID}}/edit" data-id={{.ID}} data-title={{.Name}}><i class="octicon octicon-pencil"></i> {{$.i18n.Tr "repo.issues.label_edit"}}</a>
|
||||
{{if .IsClosed}}
|
||||
@ -111,7 +111,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{if .IsRepositoryWriter}}
|
||||
{{if or .CanWriteIssues .CanWritePulls}}
|
||||
<div class="ui small basic delete modal">
|
||||
<div class="ui icon header">
|
||||
<i class="trash icon"></i>
|
||||
|
@ -20,7 +20,7 @@
|
||||
<span class="text grey"><a {{if gt .Issue.Poster.ID 0}}href="{{.Issue.Poster.HomeLink}}"{{end}}>{{.Issue.Poster.Name}}</a> {{.i18n.Tr "repo.issues.commented_at" .Issue.HashTag $createdStr | Safe}}</span>
|
||||
<div class="ui right actions">
|
||||
{{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index) }}
|
||||
{{if .IsIssueOwner}}
|
||||
{{if or .IsIssueWriter .IsIssuePoster}}
|
||||
<div class="item action">
|
||||
<a class="edit-content" href="#"><i class="octicon octicon-pencil"></i></a>
|
||||
</div>
|
||||
@ -79,7 +79,7 @@
|
||||
{{.CsrfTokenHtml}}
|
||||
<input id="status" name="status" type="hidden">
|
||||
<div class="text right">
|
||||
{{if and .IsIssueOwner (not .DisableStatusChange)}}
|
||||
{{if and (or .IsIssueWriter .IsIssuePoster) (not .DisableStatusChange)}}
|
||||
{{if .Issue.IsClosed}}
|
||||
<div id="status-button" class="ui green basic button" tabindex="6" data-status="{{.i18n.Tr "repo.issues.reopen_issue"}}" data-status-and-comment="{{.i18n.Tr "repo.issues.reopen_comment_issue"}}" data-status-val="reopen">
|
||||
{{.i18n.Tr "repo.issues.reopen_issue"}}
|
||||
|
@ -23,7 +23,7 @@
|
||||
</div>
|
||||
{{end}}
|
||||
{{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID) }}
|
||||
{{if or $.IsRepositoryAdmin (eq .Poster.ID $.SignedUserID)}}
|
||||
{{if or $.Permission.IsAdmin (eq .Poster.ID $.SignedUserID)}}
|
||||
<div class="item action">
|
||||
<a class="edit-content" href="#"><i class="octicon octicon-pencil"></i></a>
|
||||
<a class="delete-comment" href="#" data-comment-id={{.HashTag}} data-url="{{$.RepoLink}}/comments/{{.ID}}/delete" data-locale="{{$.i18n.Tr "repo.issues.delete_comment_confirm"}}"><i class="octicon octicon-x"></i></a>
|
||||
|
@ -2,7 +2,7 @@
|
||||
<div class="ui segment metas">
|
||||
{{template "repo/issue/branch_selector_field" .}}
|
||||
|
||||
<div class="ui {{if not .IsRepositoryWriter}}disabled{{end}} floating jump select-label dropdown">
|
||||
<div class="ui {{if not .IsIssueWriter}}disabled{{end}} floating jump select-label dropdown">
|
||||
<span class="text">
|
||||
<strong>{{.i18n.Tr "repo.issues.new.labels"}}</strong>
|
||||
<span class="octicon octicon-gear"></span>
|
||||
@ -27,7 +27,7 @@
|
||||
|
||||
<div class="ui divider"></div>
|
||||
|
||||
<div class="ui {{if not .IsRepositoryWriter}}disabled{{end}} floating jump select-milestone dropdown">
|
||||
<div class="ui {{if not .IsIssueWriter}}disabled{{end}} floating jump select-milestone dropdown">
|
||||
<span class="text">
|
||||
<strong>{{.i18n.Tr "repo.issues.new.milestone"}}</strong>
|
||||
<span class="octicon octicon-gear"></span>
|
||||
@ -68,7 +68,7 @@
|
||||
<div class="ui divider"></div>
|
||||
|
||||
<input id="assignee_id" name="assignee_id" type="hidden" value="{{.assignee_id}}">
|
||||
<div class="ui {{if not .IsRepositoryWriter}}disabled{{end}} floating jump select-assignees-modify dropdown">
|
||||
<div class="ui {{if not .IsIssueWriter}}disabled{{end}} floating jump select-assignees-modify dropdown">
|
||||
<span class="text">
|
||||
<strong>{{.i18n.Tr "repo.issues.new.assignees"}}</strong>
|
||||
<span class="octicon octicon-gear"></span>
|
||||
@ -223,7 +223,7 @@
|
||||
{{if .Issue.IsOverdue}}
|
||||
<span style="color: red;">{{.i18n.Tr "repo.issues.due_date_overdue"}}</span>
|
||||
{{end}}
|
||||
{{if and .IsSigned .IsRepositoryWriter}}
|
||||
{{if .IsIssueWriter}}
|
||||
<br/>
|
||||
<a style="cursor:pointer;" onclick="toggleDeadlineForm();"><i class="edit icon"></i>{{$.i18n.Tr "repo.issues.due_date_form_edit"}}</a> -
|
||||
<a style="cursor:pointer;" onclick="updateDeadline('');"><i class="remove icon"></i>{{$.i18n.Tr "repo.issues.due_date_form_remove"}}</a>
|
||||
@ -233,7 +233,7 @@
|
||||
<p><i>{{.i18n.Tr "repo.issues.due_date_not_set"}}</i></p>
|
||||
{{end}}
|
||||
|
||||
{{if and .IsSigned .IsRepositoryWriter}}
|
||||
{{if .IsIssueWriter}}
|
||||
<div {{if ne .Issue.DeadlineUnix 0}} style="display: none;"{{end}} id="deadlineForm">
|
||||
<form class="ui fluid action input" action="{{AppSubUrl}}/api/v1/repos/{{.Repository.Owner.Name}}/{{.Repository.Name}}/issues/{{.Issue.Index}}" method="post" id="update-issue-deadline-form" onsubmit="setDeadline();return false;">
|
||||
{{$.CsrfTokenHtml}}
|
||||
|
@ -6,7 +6,7 @@
|
||||
<input value="{{.Issue.Title}}">
|
||||
</div>
|
||||
</h1>
|
||||
{{if .IsIssueOwner}}
|
||||
{{if or .IsIssueWriter .IsIssuePoster}}
|
||||
<div class="four wide column">
|
||||
<div class="edit-zone text right">
|
||||
<div id="edit-title" class="ui basic green not-in-edit button">{{.i18n.Tr "repo.issues.edit"}}</div>
|
||||
|
@ -5,7 +5,7 @@
|
||||
{{template "base/alert" .}}
|
||||
<h2 class="ui header">
|
||||
{{.i18n.Tr "repo.release.releases"}}
|
||||
{{if .IsRepositoryWriter}}
|
||||
{{if .CanCreateRelease}}
|
||||
<div class="ui right">
|
||||
<a class="ui small green button" href="{{$.RepoLink}}/releases/new">
|
||||
{{.i18n.Tr "repo.release.new_release"}}
|
||||
@ -41,7 +41,7 @@
|
||||
<a href="{{$.RepoLink}}/src/tag/{{.TagName | EscapePound}}" rel="nofollow"><i class="tag icon"></i> {{.TagName}}</a>
|
||||
</h4>
|
||||
<div class="download">
|
||||
{{if $.Repository.UnitEnabled $.UnitTypeCode}}
|
||||
{{if $.Permission.CanRead $.UnitTypeCode}}
|
||||
<a href="{{$.RepoLink}}/src/commit/{{.Sha1}}" rel="nofollow"><i class="code icon"></i> {{ShortSha .Sha1}}</a>
|
||||
<a href="{{$.RepoLink}}/archive/{{.TagName | EscapePound}}.zip" rel="nofollow"><i class="octicon octicon-file-zip"></i> ZIP</a>
|
||||
<a href="{{$.RepoLink}}/archive/{{.TagName | EscapePound}}.tar.gz"><i class="octicon octicon-file-zip"></i> TAR.GZ</a>
|
||||
@ -50,7 +50,7 @@
|
||||
{{else}}
|
||||
<h3>
|
||||
<a href="{{$.RepoLink}}/src/tag/{{.TagName | EscapePound}}">{{.Title}}</a>
|
||||
{{if $.IsRepositoryWriter}}<small>(<a href="{{$.RepoLink}}/releases/edit/{{.TagName | EscapePound}}" rel="nofollow">{{$.i18n.Tr "repo.release.edit"}}</a>)</small>{{end}}
|
||||
{{if $.CanCreateRelease}}<small>(<a href="{{$.RepoLink}}/releases/edit/{{.TagName | EscapePound}}" rel="nofollow">{{$.i18n.Tr "repo.release.edit"}}</a>)</small>{{end}}
|
||||
</h3>
|
||||
<p class="text grey">
|
||||
<span class="author">
|
||||
@ -66,7 +66,7 @@
|
||||
<div class="download">
|
||||
<h2>{{$.i18n.Tr "repo.release.downloads"}}</h2>
|
||||
<ul class="list">
|
||||
{{if $.Repository.UnitEnabled $.UnitTypeCode}}
|
||||
{{if $.Permission.CanRead $.UnitTypeCode}}
|
||||
<li>
|
||||
<a href="{{$.RepoLink}}/archive/{{.TagName | EscapePound}}.zip" rel="nofollow"><strong><i class="octicon octicon-file-zip"></i> {{$.i18n.Tr "repo.release.source_code"}} (ZIP)</strong></a>
|
||||
</li>
|
||||
|
@ -266,7 +266,7 @@
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
{{if .IsRepositoryOwner}}
|
||||
{{if .Permission.IsOwner}}
|
||||
<h4 class="ui top attached warning header">
|
||||
{{.i18n.Tr "repo.settings.danger_zone"}}
|
||||
</h4>
|
||||
@ -294,7 +294,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{if .Repository.UnitEnabled $.UnitTypeWiki}}
|
||||
{{if .Permission.CanRead $.UnitTypeWiki}}
|
||||
<div class="ui divider"></div>
|
||||
|
||||
<div class="item">
|
||||
@ -324,7 +324,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{if .IsRepositoryOwner}}
|
||||
{{if .Permission.IsOwner}}
|
||||
{{if .Repository.IsMirror}}
|
||||
<div class="ui small modal" id="convert-repo-modal">
|
||||
<div class="header">
|
||||
|
@ -1,7 +1,7 @@
|
||||
{{if .PageIsSettingsHooksEdit}}
|
||||
<h4 class="ui top attached header">
|
||||
{{.i18n.Tr "repo.settings.recent_deliveries"}}
|
||||
{{if .IsRepositoryAdmin}}
|
||||
{{if .Permission.IsAdmin}}
|
||||
<div class="ui right">
|
||||
<button class="ui teal tiny button poping up" id="test-delivery" data-content=
|
||||
"{{.i18n.Tr "repo.settings.webhook.test_delivery_desc"}}" data-variation="inverted tiny" data-link="{{.Link}}/test" data-redirect="{{.Link}}">{{.i18n.Tr "repo.settings.webhook.test_delivery"}}</button>
|
||||
|
@ -1,11 +1,11 @@
|
||||
<div class="ui segment sub-menu">
|
||||
<div class="ui two horizontal center link list">
|
||||
{{if and (.Repository.UnitEnabled $.UnitTypeCode) (not .IsBareRepo)}}
|
||||
{{if and (.Permission.CanRead $.UnitTypeCode) (not .IsBareRepo)}}
|
||||
<div class="item{{if .PageIsCommits}} active{{end}}">
|
||||
<a href="{{.RepoLink}}/commits{{if .IsViewBranch}}/branch{{else if .IsViewTag}}/tag{{else if .IsViewCommit}}/commit{{end}}/{{EscapePound .BranchName}}"><i class="octicon octicon-history"></i> <b>{{.CommitsCount}}</b> {{.i18n.Tr (TrN .i18n.Lang .CommitsCount "repo.commit" "repo.commits") }}</a>
|
||||
</div>
|
||||
{{end}}
|
||||
{{if and (.Repository.UnitEnabled $.UnitTypeCode) (not .IsBareRepo) }}
|
||||
{{if and (.Permission.CanRead $.UnitTypeCode) (not .IsBareRepo) }}
|
||||
<div class="item{{if .PageIsBranches}} active{{end}}">
|
||||
<a href="{{.RepoLink}}/branches/"><i class="octicon octicon-git-branch"></i> <b>{{.BranchesCount}}</b> {{.i18n.Tr (TrN .i18n.Lang .BranchesCount "repo.branch" "repo.branches") }}</a>
|
||||
</div>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<div class="ui container">
|
||||
<div class="ui header">
|
||||
{{.i18n.Tr "repo.wiki.pages"}}
|
||||
{{if and .IsRepositoryWriter (not .IsRepositoryMirror)}}
|
||||
{{if and .CanWriteWiki (not .IsRepositoryMirror)}}
|
||||
<div class="ui right">
|
||||
<a class="ui green small button" href="{{.RepoLink}}/wiki/_new">{{.i18n.Tr "repo.wiki.new_page_button"}}</a>
|
||||
</div>
|
||||
|
@ -6,7 +6,7 @@
|
||||
<span class="mega-octicon octicon-book"></span>
|
||||
<h2>{{.i18n.Tr "repo.wiki.welcome"}}</h2>
|
||||
<p>{{.i18n.Tr "repo.wiki.welcome_desc"}}</p>
|
||||
{{if and .IsRepositoryWriter (not .Repository.IsMirror)}}
|
||||
{{if and .CanWriteWiki (not .Repository.IsMirror)}}
|
||||
<a class="ui green button" href="{{.RepoLink}}/wiki/_new">{{.i18n.Tr "repo.wiki.create_first_page"}}</a>
|
||||
{{end}}
|
||||
</div>
|
||||
|
@ -63,7 +63,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="eight wide right aligned column">
|
||||
{{if and .IsRepositoryWriter (not .Repository.IsMirror)}}
|
||||
{{if and .CanWriteWiki (not .Repository.IsMirror)}}
|
||||
<div class="ui right">
|
||||
<a class="ui small button" href="{{.RepoLink}}/wiki/{{.PageURL}}/_edit">{{.i18n.Tr "repo.wiki.edit_page_button"}}</a>
|
||||
<a class="ui green small button" href="{{.RepoLink}}/wiki/_new">{{.i18n.Tr "repo.wiki.new_page_button"}}</a>
|
||||
|
Reference in New Issue
Block a user