Skip to content

Commit 1fa6c06

Browse files
committed
Merge remote-tracking branch 'upstream/main'
* upstream/main: [skip ci] Updated licenses and gitignores Add `WithPullRequest` for `actionsNotifier` (go-gitea#25144) [skip ci] Updated translations via Crowdin [skip ci] Updated translations via Crowdin Update github.com/google/go-github to v53 (go-gitea#25157) Fix bug for code search if code is disabled (go-gitea#25173) Minor arc-green color tweaks (go-gitea#25175) Fix duplicate Reviewed-by trailers (go-gitea#24796) Fix go-gitea#25133 (go-gitea#25162) Fix mobile navbar and misc cleanups (go-gitea#25134) Button and color enhancements (go-gitea#24989) Fix setup-go actions (go-gitea#25167) # Conflicts: # templates/base/head_navbar.tmpl
2 parents 482bdb7 + d67e411 commit 1fa6c06

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+971
-720
lines changed

.github/workflows/cron-licenses.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ jobs:
1010
if: github.repository == 'go-gitea/gitea'
1111
steps:
1212
- uses: actions/checkout@v3
13-
- uses: actions/setup-go@v3
13+
- uses: actions/setup-go@v4
1414
with:
15-
go-version: ">=1.20.1"
15+
go-version: ">=1.20"
16+
check-latest: true
1617
- run: make generate-license generate-gitignore
1718
timeout-minutes: 40
1819
- name: push translations to repo

.github/workflows/pull-db-tests.yml

+12-6
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ jobs:
4141
- uses: actions/checkout@v3
4242
- uses: actions/setup-go@v4
4343
with:
44-
go-version: ">=1.20.0"
44+
go-version: ">=1.20"
45+
check-latest: true
4546
- name: Add hosts to /etc/hosts
4647
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 pgsql ldap minio" | sudo tee -a /etc/hosts'
4748
- run: make deps-backend
@@ -65,7 +66,8 @@ jobs:
6566
- uses: actions/checkout@v3
6667
- uses: actions/setup-go@v4
6768
with:
68-
go-version: ">=1.20.0"
69+
go-version: ">=1.20"
70+
check-latest: true
6971
- run: make deps-backend
7072
- run: make backend
7173
env:
@@ -123,7 +125,8 @@ jobs:
123125
- uses: actions/checkout@v3
124126
- uses: actions/setup-go@v4
125127
with:
126-
go-version: ">=1.20.0"
128+
go-version: ">=1.20"
129+
check-latest: true
127130
- name: Add hosts to /etc/hosts
128131
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts'
129132
- run: make deps-backend
@@ -172,7 +175,8 @@ jobs:
172175
- uses: actions/checkout@v3
173176
- uses: actions/setup-go@v4
174177
with:
175-
go-version: ">=1.20.0"
178+
go-version: ">=1.20"
179+
check-latest: true
176180
- name: Add hosts to /etc/hosts
177181
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts'
178182
- run: make deps-backend
@@ -203,7 +207,8 @@ jobs:
203207
- uses: actions/checkout@v3
204208
- uses: actions/setup-go@v4
205209
with:
206-
go-version: ">=1.20.0"
210+
go-version: ">=1.20"
211+
check-latest: true
207212
- name: Add hosts to /etc/hosts
208213
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql8" | sudo tee -a /etc/hosts'
209214
- run: make deps-backend
@@ -233,7 +238,8 @@ jobs:
233238
- uses: actions/checkout@v3
234239
- uses: actions/setup-go@v4
235240
with:
236-
go-version: ">=1.20.0"
241+
go-version: ">=1.20"
242+
check-latest: true
237243
- name: Add hosts to /etc/hosts
238244
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mssql" | sudo tee -a /etc/hosts'
239245
- run: make deps-backend

assets/go-licenses.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contrib/backport/backport.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
"strings"
1818
"syscall"
1919

20-
"github.com/google/go-github/v52/github"
20+
"github.com/google/go-github/v53/github"
2121
"github.com/urfave/cli"
2222
"gopkg.in/yaml.v3"
2323
)

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ require (
5555
github.com/gogs/cron v0.0.0-20171120032916-9f6c956d3e14
5656
github.com/gogs/go-gogs-client v0.0.0-20210131175652-1d7215cd8d85
5757
github.com/golang-jwt/jwt/v4 v4.5.0
58-
github.com/google/go-github/v52 v52.0.0
58+
github.com/google/go-github/v53 v53.0.0
5959
github.com/google/pprof v0.0.0-20230502171905-255e3b9b56de
6060
github.com/google/uuid v1.3.0
6161
github.com/gorilla/feeds v1.1.1

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -565,8 +565,8 @@ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
565565
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
566566
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
567567
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
568-
github.com/google/go-github/v52 v52.0.0 h1:uyGWOY+jMQ8GVGSX8dkSwCzlehU3WfdxQ7GweO/JP7M=
569-
github.com/google/go-github/v52 v52.0.0/go.mod h1:WJV6VEEUPuMo5pXqqa2ZCZEdbQqua4zAk2MZTIo+m+4=
568+
github.com/google/go-github/v53 v53.0.0 h1:T1RyHbSnpHYnoF0ZYKiIPSgPtuJ8G6vgc0MKodXsQDQ=
569+
github.com/google/go-github/v53 v53.0.0/go.mod h1:XhFRObz+m/l+UCm9b7KSIC3lT3NWSXGt7mOsAWEloao=
570570
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
571571
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
572572
github.com/google/go-tpm v0.1.2-0.20190725015402-ae6dd98980d4/go.mod h1:H9HbmUG2YgV/PHITkO7p6wxEEj/v5nlsVWIwumwH2NI=

models/fixtures/review.yml

+27
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,30 @@
105105
official: true
106106
updated_unix: 1603196749
107107
created_unix: 1603196749
108+
109+
-
110+
id: 13
111+
type: 1
112+
reviewer_id: 5
113+
issue_id: 11
114+
content: "old review from user5"
115+
updated_unix: 946684820
116+
created_unix: 946684820
117+
118+
-
119+
id: 14
120+
type: 1
121+
reviewer_id: 5
122+
issue_id: 11
123+
content: "duplicate review from user5 (latest)"
124+
updated_unix: 946684830
125+
created_unix: 946684830
126+
127+
-
128+
id: 15
129+
type: 1
130+
reviewer_id: 6
131+
issue_id: 11
132+
content: "singular review from user6 and final review for this pr"
133+
updated_unix: 946684831
134+
created_unix: 946684831

models/issues/pull.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ func (pr *PullRequest) getReviewedByLines(writer io.Writer) error {
404404
defer committer.Close()
405405

406406
// Note: This doesn't page as we only expect a very limited number of reviews
407-
reviews, err := FindReviews(ctx, FindReviewOptions{
407+
reviews, err := FindLatestReviews(ctx, FindReviewOptions{
408408
Type: ReviewTypeApprove,
409409
IssueID: pr.IssueID,
410410
OfficialOnly: setting.Repository.PullRequest.DefaultMergeMessageOfficialApproversOnly,

models/issues/pull_test.go

+12
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
issues_model "code.gitea.io/gitea/models/issues"
1111
"code.gitea.io/gitea/models/unittest"
1212
user_model "code.gitea.io/gitea/models/user"
13+
"code.gitea.io/gitea/modules/setting"
1314

1415
"github.com/stretchr/testify/assert"
1516
)
@@ -325,3 +326,14 @@ func TestParseCodeOwnersLine(t *testing.T) {
325326
assert.Equal(t, g.Tokens, tokens, "Codeowners tokenizer failed")
326327
}
327328
}
329+
330+
func TestGetApprovers(t *testing.T) {
331+
assert.NoError(t, unittest.PrepareTestDatabase())
332+
pr := unittest.AssertExistsAndLoadBean(t, &issues_model.PullRequest{ID: 5})
333+
// Official reviews are already deduplicated. Allow unofficial reviews
334+
// to assert that there are no duplicated approvers.
335+
setting.Repository.PullRequest.DefaultMergeMessageOfficialApproversOnly = false
336+
approvers := pr.GetApprovers()
337+
expected := "Reviewed-by: User Five <user5@example.com>\nReviewed-by: User Six <user6@example.com>\n"
338+
assert.EqualValues(t, expected, approvers)
339+
}

models/issues/review.go

+21
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,27 @@ func FindReviews(ctx context.Context, opts FindReviewOptions) ([]*Review, error)
275275
Find(&reviews)
276276
}
277277

278+
// FindLatestReviews returns only latest reviews per user, passing FindReviewOptions
279+
func FindLatestReviews(ctx context.Context, opts FindReviewOptions) ([]*Review, error) {
280+
reviews := make([]*Review, 0, 10)
281+
cond := opts.toCond()
282+
sess := db.GetEngine(ctx).Where(cond)
283+
if opts.Page > 0 {
284+
sess = db.SetSessionPagination(sess, &opts)
285+
}
286+
287+
sess.In("id", builder.
288+
Select("max ( id ) ").
289+
From("review").
290+
Where(cond).
291+
GroupBy("reviewer_id"))
292+
293+
return reviews, sess.
294+
Asc("created_unix").
295+
Asc("id").
296+
Find(&reviews)
297+
}
298+
278299
// CountReviews returns count of reviews passing FindReviewOptions
279300
func CountReviews(opts FindReviewOptions) (int64, error) {
280301
return db.GetEngine(db.DefaultContext).Where(opts.toCond()).Count(&Review{})

models/issues/review_test.go

+12
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,18 @@ func TestFindReviews(t *testing.T) {
7171
assert.Equal(t, "Demo Review", reviews[0].Content)
7272
}
7373

74+
func TestFindLatestReviews(t *testing.T) {
75+
assert.NoError(t, unittest.PrepareTestDatabase())
76+
reviews, err := issues_model.FindLatestReviews(db.DefaultContext, issues_model.FindReviewOptions{
77+
Type: issues_model.ReviewTypeApprove,
78+
IssueID: 11,
79+
})
80+
assert.NoError(t, err)
81+
assert.Len(t, reviews, 2)
82+
assert.Equal(t, "duplicate review from user5 (latest)", reviews[0].Content)
83+
assert.Equal(t, "singular review from user6 and final review for this pr", reviews[1].Content)
84+
}
85+
7486
func TestGetCurrentReview(t *testing.T) {
7587
assert.NoError(t, unittest.PrepareTestDatabase())
7688
issue := unittest.AssertExistsAndLoadBean(t, &issues_model.Issue{ID: 2})
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
ASWF Digital Assets License v1.1
2+
3+
License for <Asset Name> (the "Asset Name").
4+
5+
<Asset Name> Copyright <Year> <Asset Owner>. All rights reserved.
6+
7+
Redistribution and use of these digital assets, with or without modification, solely for education, training, research, software and hardware development, performance benchmarking (including publication of benchmark results and permitting reproducibility of the benchmark results by third parties), or software and hardware product demonstrations, are permitted provided that the following conditions are met:
8+
9+
1. Redistributions of these digital assets or any part of them must include the above copyright notice, this list of conditions and the disclaimer below, and if applicable, a description of how the redistributed versions of the digital assets differ from the originals.
10+
11+
2. Publications showing images derived from these digital assets must include the above copyright notice.
12+
13+
3. The names of copyright holder or the names of its contributors may NOT be used to promote or to imply endorsement, sponsorship, or affiliation with products developed or tested utilizing these digital assets or benchmarking results obtained from these digital assets, without prior written permission from copyright holder.
14+
15+
4. The assets and their output may only be referred to as the Asset Name listed above, and your use of the Asset Name shall be solely to identify the digital assets. Other than as expressly permitted by this License, you may NOT use any trade names, trademarks, service marks, or product names of the copyright holder for any purpose.
16+
17+
DISCLAIMER: THESE DIGITAL ASSETS ARE PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THESE DIGITAL ASSETS, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

options/license/GPL-3.0-only

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
GNU GENERAL PUBLIC LICENSE
22
Version 3, 29 June 2007
33

4-
Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>
4+
Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/>
55

66
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
77

@@ -215,7 +215,7 @@ To do so, attach the following notices to the program. It is safest to attach th
215215

216216
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
217217

218-
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
218+
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
219219

220220
Also add information on how to contact you by electronic and paper mail.
221221

@@ -227,6 +227,6 @@ If the program does terminal interaction, make it output a short notice like thi
227227

228228
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”.
229229

230-
You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <http://www.gnu.org/licenses/>.
230+
You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>.
231231

232-
The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <http://www.gnu.org/philosophy/why-not-lgpl.html>.
232+
The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <https://www.gnu.org/philosophy/why-not-lgpl.html>.

options/license/GPL-3.0-or-later

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
GNU GENERAL PUBLIC LICENSE
22
Version 3, 29 June 2007
33

4-
Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>
4+
Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/>
55

66
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
77

@@ -215,7 +215,7 @@ To do so, attach the following notices to the program. It is safest to attach th
215215

216216
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
217217

218-
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
218+
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
219219

220220
Also add information on how to contact you by electronic and paper mail.
221221

@@ -227,6 +227,6 @@ If the program does terminal interaction, make it output a short notice like thi
227227

228228
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”.
229229

230-
You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <http://www.gnu.org/licenses/>.
230+
You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>.
231231

232-
The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <http://www.gnu.org/philosophy/why-not-lgpl.html>.
232+
The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <https://www.gnu.org/philosophy/why-not-lgpl.html>.

0 commit comments

Comments
 (0)