mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Implement "conversation lock" for issue comments (#5073)
This commit is contained in:
@@ -69,7 +69,38 @@
|
||||
{{if and .Issue.IsPull (not $.Repository.IsArchived)}}
|
||||
{{ template "repo/issue/view_content/pull". }}
|
||||
{{end}}
|
||||
|
||||
{{if .IsSigned}}
|
||||
{{ if or .IsRepoAdmin .IsRepoIssuesWriter (or (not .Issue.IsLocked)) }}
|
||||
<div class="comment form">
|
||||
<a class="avatar" href="{{.SignedUser.HomeLink}}">
|
||||
<img src="{{.SignedUser.RelAvatarLink}}">
|
||||
</a>
|
||||
<div class="content">
|
||||
<form class="ui segment form" id="comment-form" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/comments" method="post">
|
||||
{{template "repo/issue/comment_tab" .}}
|
||||
{{.CsrfTokenHtml}}
|
||||
<input id="status" name="status" type="hidden">
|
||||
<div class="text right">
|
||||
{{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"}}
|
||||
</div>
|
||||
{{else}}
|
||||
<div id="status-button" class="ui red basic button" tabindex="6" data-status="{{.i18n.Tr "repo.issues.close_issue"}}" data-status-and-comment="{{.i18n.Tr "repo.issues.close_comment_issue"}}" data-status-val="close">
|
||||
{{.i18n.Tr "repo.issues.close_issue"}}
|
||||
</div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
<button class="ui green button" tabindex="5">
|
||||
{{.i18n.Tr "repo.issues.create_comment"}}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{else}}
|
||||
{{if .Repository.IsArchived}}
|
||||
<div class="ui warning message">
|
||||
{{if .Issue.IsPull}}
|
||||
@@ -114,6 +145,7 @@
|
||||
</div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{end}}
|
||||
</ui>
|
||||
</div>
|
||||
|
||||
|
@@ -2,7 +2,11 @@
|
||||
{{range .Issue.Comments}}
|
||||
{{ $createdStr:= TimeSinceUnix .CreatedUnix $.Lang }}
|
||||
|
||||
<!-- 0 = COMMENT, 1 = REOPEN, 2 = CLOSE, 3 = ISSUE_REF, 4 = COMMIT_REF, 5 = COMMENT_REF, 6 = PULL_REF, 7 = COMMENT_LABEL, 12 = START_TRACKING, 13 = STOP_TRACKING, 14 = ADD_TIME_MANUAL, 16 = ADDED_DEADLINE, 17 = MODIFIED_DEADLINE, 18 = REMOVED_DEADLINE, 19 = ADD_DEPENDENCY, 20 = REMOVE_DEPENDENCY, 21 = CODE, 22 = REVIEW -->
|
||||
<!-- 0 = COMMENT, 1 = REOPEN, 2 = CLOSE, 3 = ISSUE_REF, 4 = COMMIT_REF,
|
||||
5 = COMMENT_REF, 6 = PULL_REF, 7 = COMMENT_LABEL, 12 = START_TRACKING,
|
||||
13 = STOP_TRACKING, 14 = ADD_TIME_MANUAL, 16 = ADDED_DEADLINE, 17 = MODIFIED_DEADLINE,
|
||||
18 = REMOVED_DEADLINE, 19 = ADD_DEPENDENCY, 20 = REMOVE_DEPENDENCY, 21 = CODE,
|
||||
22 = REVIEW, 23 = ISSUE_LOCKED, 24 = ISSUE_UNLOCKED -->
|
||||
{{if eq .Type 0}}
|
||||
<div class="comment" id="{{.HashTag}}">
|
||||
<a class="avatar" {{if gt .Poster.ID 0}}href="{{.Poster.HomeLink}}"{{end}}>
|
||||
@@ -355,5 +359,35 @@
|
||||
{{end}}
|
||||
{{end}}
|
||||
</div>
|
||||
{{else if eq .Type 23}}
|
||||
<div class="event">
|
||||
<span class="octicon octicon-lock"
|
||||
style="font-size:20px;margin-left:-28.5px; margin-right: -1px"></span>
|
||||
<a class="ui avatar image" href="{{.Poster.HomeLink}}">
|
||||
<img src="{{.Poster.RelAvatarLink}}">
|
||||
</a>
|
||||
|
||||
{{ if .Content }}
|
||||
<span class="text grey"><a href="{{.Poster.HomeLink}}">{{.Poster.Name}}</a>
|
||||
{{$.i18n.Tr "repo.issues.lock_with_reason" .Content $createdStr | Safe}}
|
||||
</span>
|
||||
{{ else }}
|
||||
<span class="text grey"><a href="{{.Poster.HomeLink}}">{{.Poster.Name}}</a>
|
||||
{{$.i18n.Tr "repo.issues.lock_no_reason" $createdStr | Safe}}
|
||||
</span>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{else if eq .Type 24}}
|
||||
<div class="event">
|
||||
<span class="octicon octicon-key"
|
||||
style="font-size:20px;margin-left:-28.5px; margin-right: -1px"></span>
|
||||
<a class="ui avatar image" href="{{.Poster.HomeLink}}">
|
||||
<img src="{{.Poster.RelAvatarLink}}">
|
||||
</a>
|
||||
|
||||
<span class="text grey"><a href="{{.Poster.HomeLink}}">{{.Poster.Name}}</a>
|
||||
{{$.i18n.Tr "repo.issues.unlock_comment" $createdStr | Safe}}
|
||||
</span>
|
||||
</div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
@@ -335,6 +335,91 @@
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
{{ if .IsRepoAdmin }}
|
||||
<div class="ui divider"></div>
|
||||
<div class="ui watching">
|
||||
<div>
|
||||
<button class="fluid ui show-modal button {{if .Issue.IsLocked }} negative {{ end }}" data-modal="#lock">
|
||||
{{if .Issue.IsLocked}}
|
||||
<i class="octicon octicon-key"></i>
|
||||
{{.i18n.Tr "repo.issues.unlock"}}
|
||||
{{else}}
|
||||
<i class="octicon octicon-lock"></i>
|
||||
{{.i18n.Tr "repo.issues.lock"}}
|
||||
{{end}}
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="ui tiny modal" id="lock">
|
||||
<div class="header">
|
||||
{{ if .Issue.IsLocked }}
|
||||
{{.i18n.Tr "repo.issues.unlock.title"}}
|
||||
{{ else }}
|
||||
{{.i18n.Tr "repo.issues.lock.title"}}
|
||||
{{ end }}
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="ui warning message text left">
|
||||
{{ if .Issue.IsLocked }}
|
||||
{{.i18n.Tr "repo.issues.unlock.notice_1"}}<br>
|
||||
{{.i18n.Tr "repo.issues.unlock.notice_2"}}<br>
|
||||
{{ else }}
|
||||
{{.i18n.Tr "repo.issues.lock.notice_1"}}<br>
|
||||
{{.i18n.Tr "repo.issues.lock.notice_2"}}<br>
|
||||
{{.i18n.Tr "repo.issues.lock.notice_3"}}<br>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
<form class="ui form" action="{{$.RepoLink}}/issues/{{.Issue.Index}}{{ if .Issue.IsLocked }}/unlock{{ else }}/lock{{ end }}"
|
||||
method="post">
|
||||
{{.CsrfTokenHtml}}
|
||||
|
||||
{{ if not .Issue.IsLocked }}
|
||||
<div class="field">
|
||||
<strong> {{ .i18n.Tr "repo.issues.lock.reason" }} </strong>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<div class="ui fluid dropdown selection" tabindex="0">
|
||||
|
||||
<select name="reason">
|
||||
<option value=""> </option>
|
||||
{{range .LockReasons}}
|
||||
<option value="{{.}}">{{.}}</option>
|
||||
{{end}}
|
||||
</select>
|
||||
<i class="dropdown icon"></i>
|
||||
|
||||
<div class="default text"> </div>
|
||||
|
||||
<div class="menu transition hidden" tabindex="-1" style="display: block !important;">
|
||||
{{range .LockReasons}}
|
||||
<div class="item" data-value="{{.}}">{{.}}</div>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
<div class="text right actions">
|
||||
<div class="ui cancel button">{{.i18n.Tr "settings.cancel"}}</div>
|
||||
<button class="ui red button">
|
||||
{{ if .Issue.IsLocked }}
|
||||
{{.i18n.Tr "repo.issues.unlock_confirm"}}
|
||||
{{ else }}
|
||||
{{.i18n.Tr "repo.issues.lock_confirm"}}
|
||||
{{ end }}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{{if and .CanCreateIssueDependencies (not .Repository.IsArchived)}}
|
||||
|
Reference in New Issue
Block a user