not show ref-in-new-issue pop when issue was disabled (#15761)

fix #15718

Signed-off-by: a1012112796 <1012112796@qq.com>
This commit is contained in:
a1012112796 2021-05-07 19:59:01 +08:00 committed by GitHub
parent bdc1697729
commit c25813182c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

AI 샘플 코드 생성 중입니다

Loading...
2 changed files with 23 additions and 7 deletions

View File

@ -111,15 +111,17 @@
{{end}}
</tbody>
</table>
<div class="code-view-menu-list ui fluid popup transition hidden">
<div class="ui column relaxed equal height">
<div class="column">
<div class="ui link list">
<a class="item ref-in-new-issue" href="{{.RepoLink}}/issues/new?body={{URLJoin AppUrl .RepoLink}}/src/commit/{{.CommitID}}/{{EscapePound .TreePath}}">{{.i18n.Tr "repo.issues.context.reference_issue"}}</a>
{{if $.Permission.CanRead $.UnitTypeIssues}}
<div class="code-view-menu-list ui fluid popup transition hidden">
<div class="ui column relaxed equal height">
<div class="column">
<div class="ui link list">
<a class="item ref-in-new-issue" href="{{.RepoLink}}/issues/new?body={{URLJoin AppUrl .RepoLink}}/src/commit/{{.CommitID}}/{{EscapePound .TreePath}}">{{.i18n.Tr "repo.issues.context.reference_issue"}}</a>
</div>
</div>
</div>
</div>
</div>
</div>
{{end}}
{{end}}
{{end}}
</div>

View File

@ -2208,6 +2208,10 @@ function searchRepositories() {
}
function showCodeViewMenu() {
if ($('.code-view-menu-list').length === 0) {
return;
}
// Get clicked tr
const $code_tr = $('.code-view td.lines-code.active').parent();
@ -2873,6 +2877,11 @@ function selectRange($list, $select, $from) {
// add hashchange to permalink
const $issue = $('a.ref-in-new-issue');
if ($issue.length === 0) {
return;
}
const matched = $issue.attr('href').match(/%23L\d+$|%23L\d+-L\d+$/);
if (matched) {
$issue.attr('href', $issue.attr('href').replace($issue.attr('href').substr(matched.index), `%23L${a}-L${b}`));
@ -2888,6 +2897,11 @@ function selectRange($list, $select, $from) {
// add hashchange to permalink
const $issue = $('a.ref-in-new-issue');
if ($issue.length === 0) {
return;
}
const matched = $issue.attr('href').match(/%23L\d+$|%23L\d+-L\d+$/);
if (matched) {
$issue.attr('href', $issue.attr('href').replace($issue.attr('href').substr(matched.index), `%23${$select.attr('rel')}`));