Skip to content

Commit 9acfe6f

Browse files
authored
Merge branch 'main' into viewed-files
2 parents f618ce0 + 672e5a7 commit 9acfe6f

File tree

14 files changed

+115
-7
lines changed

14 files changed

+115
-7
lines changed

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,29 @@ This changelog goes through all the changes that have been made in each release
44
without substantial changes to our git log; to see the highlights of what has
55
been added to each release, please refer to the [blog](https://blog.gitea.io).
66

7+
## [1.16.7](https://github.com/go-gitea/gitea/releases/tag/v1.16.7) - 2022-05-02
8+
9+
* SECURITY
10+
* Escape git fetch remote (#19487) (#19490)
11+
* BUGFIXES
12+
* Don't overwrite err with nil (#19572) (#19574)
13+
* On Migrations, only write commit-graph if wiki clone was successful (#19563) (#19568)
14+
* Respect DefaultUserIsRestricted system default when creating new user (#19310) (#19560)
15+
* Don't error when branch's commit doesn't exist (#19547) (#19548)
16+
* Support `hostname:port` to pass host matcher's check (#19543) (#19544)
17+
* Prevent intermittent race in attribute reader close (#19537) (#19539)
18+
* Fix 64-bit atomic operations on 32-bit machines (#19531) (#19532)
19+
* Prevent dangling archiver goroutine (#19516) (#19526)
20+
* Fix migrate release from github (#19510) (#19523)
21+
* When view _Siderbar or _Footer, just display once (#19501) (#19522)
22+
* Fix blame page select range error and some typos (#19503)
23+
* Fix name of doctor fix "authorized-keys" in hints (#19464) (#19484)
24+
* User specific repoID or xorm builder conditions for issue search (#19475) (#19476)
25+
* Prevent dangling cat-file calls (goroutine alternative) (#19454) (#19466)
26+
* RepoAssignment ensure to close before overwrite (#19449) (#19460)
27+
* Set correct PR status on 3way on conflict checking (#19457) (#19458)
28+
* Mark TemplateLoading error as "UnprocessableEntity" (#19445) (#19446)
29+
730
## [1.16.6](https://github.com/go-gitea/gitea/releases/tag/v1.16.6) - 2022-04-20
831

932
* ENHANCEMENTS

docs/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ params:
1818
description: Git with a cup of tea
1919
author: The Gitea Authors
2020
website: https://docs.gitea.io
21-
version: 1.16.6
21+
version: 1.16.7
2222
minGoVersion: 1.17
2323
goVersion: 1.18
2424
minNodeVersion: 14

options/locale/locale_pt-BR.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,6 +1479,7 @@ issues.content_history.created=criado
14791479
issues.content_history.delete_from_history=Excluir do histórico
14801480
issues.content_history.delete_from_history_confirm=Excluir do histórico?
14811481
issues.content_history.options=Opções
1482+
issues.reference_link=Referência: %s
14821483

14831484
compare.compare_base=base
14841485
compare.compare_head=comparar

options/locale/locale_pt-PT.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1478,6 +1478,7 @@ issues.content_history.created=criado
14781478
issues.content_history.delete_from_history=Eliminar do histórico
14791479
issues.content_history.delete_from_history_confirm=Eliminar do histórico?
14801480
issues.content_history.options=Opções
1481+
issues.reference_link=Referência: %s
14811482

14821483
compare.compare_base=base
14831484
compare.compare_head=comparar

routers/web/repo/pull.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,11 +765,27 @@ func ViewPullFiles(ctx *context.Context) {
765765
if ctx.Written() {
766766
return
767767
}
768-
ctx.Data["CurrentReview"], err = models.GetCurrentReview(ctx.Doer, issue)
768+
769+
currentReview, err := models.GetCurrentReview(ctx.Doer, issue)
769770
if err != nil && !models.IsErrReviewNotExist(err) {
770771
ctx.ServerError("GetCurrentReview", err)
771772
return
772773
}
774+
numPendingCodeComments := int64(0)
775+
if currentReview != nil {
776+
numPendingCodeComments, err = models.CountComments(&models.FindCommentsOptions{
777+
Type: models.CommentTypeCode,
778+
ReviewID: currentReview.ID,
779+
IssueID: issue.ID,
780+
})
781+
if err != nil {
782+
ctx.ServerError("CountComments", err)
783+
return
784+
}
785+
}
786+
ctx.Data["CurrentReview"] = currentReview
787+
ctx.Data["PendingCodeCommentNumber"] = numPendingCodeComments
788+
773789
getBranchData(ctx, issue)
774790
ctx.Data["IsIssuePoster"] = ctx.IsSigned && issue.IsPoster(ctx.Doer.ID)
775791
ctx.Data["HasIssuesOrPullsWritePermission"] = ctx.Repo.CanWriteIssuesOrPulls(issue.IsPull)

templates/repo/diff/comments.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<div class="comment-header-right actions df ac">
3838
{{if and .Review}}
3939
{{if eq .Review.Type 0}}
40-
<div class="ui label basic small yellow">
40+
<div class="ui label basic small yellow pending-label">
4141
{{$.root.i18n.Tr "repo.issues.review.pending"}}
4242
</div>
4343
{{else}}

templates/repo/diff/new_review.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<div class="ui top right pointing dropdown custom" id="review-box">
22
<div class="ui tiny green button btn-review">
33
{{.i18n.Tr "repo.diff.review"}}
4+
<span class="ui small label review-comments-counter" data-pending-comment-number="{{.PendingCodeCommentNumber}}">{{.PendingCodeCommentNumber}}</span>
45
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
56
</div>
67
<div class="menu review-box">

templates/repo/issue/new_form.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
</div>
2121
{{template "repo/issue/comment_tab" .}}
2222
<div class="text right">
23-
<button class="ui green button" tabindex="6">
23+
<button class="ui green button loading-button" tabindex="6">
2424
{{if .PageIsComparePull}}
2525
{{.i18n.Tr "repo.pulls.create"}}
2626
{{else}}

templates/repo/issue/view_content.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
</div>
122122
{{end}}
123123
{{end}}
124-
<button class="ui green button" tabindex="5">
124+
<button class="ui green button loading-button" tabindex="5">
125125
{{.i18n.Tr "repo.issues.create_comment"}}
126126
</button>
127127
</div>
@@ -172,7 +172,7 @@
172172
</div>
173173
{{end}}
174174
{{end}}
175-
<button class="ui green button" tabindex="5">
175+
<button class="ui green button loading-button" tabindex="5">
176176
{{.i18n.Tr "repo.issues.create_comment"}}
177177
</button>
178178
</div>

web_src/js/features/common-global.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,18 @@ export function initGlobalCommon() {
142142
window.location = href;
143143
}
144144
});
145+
146+
// loading-button this logic used to prevent push one form more than one time
147+
$(document).on('click', '.button.loading-button', function (e) {
148+
const $btn = $(this);
149+
150+
if ($btn.hasClass('loading')) {
151+
e.preventDefault();
152+
return false;
153+
}
154+
155+
$btn.addClass('loading disabled');
156+
});
145157
}
146158

147159
export function initGlobalDropzone() {

web_src/js/features/repo-diff.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,23 @@ import {initViewedCheckboxListenerFor, countAndUpdateViewedFiles} from './pull-v
77
const {csrfToken} = window.config;
88

99
export function initRepoDiffReviewButton() {
10+
const $reviewBox = $('#review-box');
11+
const $counter = $reviewBox.find('.review-comments-counter');
12+
1013
$(document).on('click', 'button[name="is_review"]', (e) => {
11-
$(e.target).closest('form').append('<input type="hidden" name="is_review" value="true">');
14+
const $form = $(e.target).closest('form');
15+
$form.append('<input type="hidden" name="is_review" value="true">');
16+
17+
// Watch for the form's submit event.
18+
$form.on('submit', () => {
19+
const num = parseInt($counter.attr('data-pending-comment-number')) + 1 || 1;
20+
$counter.attr('data-pending-comment-number', num);
21+
$counter.text(num);
22+
// Force the browser to reflow the DOM. This is to ensure that the browser replay the animation
23+
$reviewBox.removeClass('pulse');
24+
$reviewBox.width();
25+
$reviewBox.addClass('pulse');
26+
});
1227
});
1328
}
1429

web_src/js/features/repo-issue.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,16 @@ export function initRepoIssueCommentDelete() {
160160
_csrf: csrfToken,
161161
}).done(() => {
162162
const $conversationHolder = $this.closest('.conversation-holder');
163+
164+
// Check if this was a pending comment.
165+
if ($conversationHolder.find('.pending-label').length) {
166+
const $counter = $('#review-box .review-comments-counter');
167+
let num = parseInt($counter.attr('data-pending-comment-number')) - 1 || 0;
168+
num = Math.max(num, 0);
169+
$counter.attr('data-pending-comment-number', num);
170+
$counter.text(num);
171+
}
172+
163173
$(`#${$this.data('comment-id')}`).remove();
164174
if ($conversationHolder.length && !$conversationHolder.find('.comment').length) {
165175
const path = $conversationHolder.data('path');

web_src/less/_review.less

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,19 @@ a.blob-excerpt:hover {
242242
border: none !important;
243243
}
244244

245+
#review-box .review-comments-counter {
246+
background-color: var(--color-primary-light-4);
247+
color: #fff;
248+
}
249+
250+
#review-box:hover .review-comments-counter {
251+
background-color: var(--color-primary-light-5);
252+
}
253+
254+
#review-box .review-comments-counter[data-pending-comment-number="0"] {
255+
display: none;
256+
}
257+
245258
.pull.files.diff [id] {
246259
scroll-margin-top: 99px;
247260

web_src/less/animations.less

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,19 @@
5050
opacity: 0;
5151
}
5252
}
53+
54+
@keyframes pulse {
55+
0% {
56+
transform: scale(1);
57+
}
58+
50% {
59+
transform: scale(1.8);
60+
}
61+
100% {
62+
transform: scale(1);
63+
}
64+
}
65+
66+
.pulse {
67+
animation: pulse 2s linear;
68+
}

0 commit comments

Comments
 (0)