Skip to content

Commit 03f1311

Browse files
authored
Merge branch 'main' into lunny/model_admin_part1
2 parents 1842187 + 6874fe9 commit 03f1311

File tree

121 files changed

+650
-837
lines changed

Some content is hidden

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

121 files changed

+650
-837
lines changed

.golangci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ linters:
1515
- misspell
1616
- gocritic
1717
- bidichk
18+
- ineffassign
1819
enable-all: false
1920
disable-all: true
2021
fast: false

cmd/hook.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,6 @@ Gitea or set your environment appropriately.`, "")
293293
}
294294
} else if lastline > 0 {
295295
fmt.Fprintf(out, "\n")
296-
lastline = 0
297296
}
298297

299298
fmt.Fprintf(out, "Checked %d references in total\n", total)

contrib/environment-to-ini/environment-to-ini.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,6 @@ func DecodeSectionKey(encoded string) (string, string) {
224224
if !inKey {
225225
if splitter := strings.Index(remaining, "__"); splitter > -1 {
226226
section += remaining[:splitter]
227-
inKey = true
228227
key += remaining[splitter+2:]
229228
} else {
230229
section += remaining

docs/content/doc/advanced/config-cheat-sheet.en-us.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -982,6 +982,14 @@ Multiple sanitisation rules can be defined by adding unique subsections, e.g. `[
982982
To apply a sanitisation rules only for a specify external renderer they must use the renderer name, e.g. `[markup.sanitizer.asciidoc.rule-1]`.
983983
If the rule is defined above the renderer ini section or the name does not match a renderer it is applied to every renderer.
984984

985+
## Highlight Mappings (`highlight.mapping`)
986+
987+
- `file_extension e.g. .toml`: **language e.g. ini**. File extension to language mapping overrides.
988+
989+
- Gitea will highlight files using the `linguist-language` or `gitlab-language` attribute from the `.gitattributes` file
990+
if available. If this is not set or the language is unavailable, the file extension will be looked up
991+
in this mapping or the filetype using heuristics.
992+
985993
## Time (`time`)
986994

987995
- `FORMAT`: Time format to display on UI. i.e. RFC1123 or 2006-01-02 15:04:05

integrations/api_comment_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ func TestAPIGetComment(t *testing.T) {
119119
session := loginUser(t, repoOwner.Name)
120120
token := getTokenForLoggedInUser(t, session)
121121
req := NewRequestf(t, "GET", "/api/v1/repos/%s/%s/issues/comments/%d", repoOwner.Name, repo.Name, comment.ID)
122-
resp := session.MakeRequest(t, req, http.StatusOK)
122+
session.MakeRequest(t, req, http.StatusOK)
123123
req = NewRequestf(t, "GET", "/api/v1/repos/%s/%s/issues/comments/%d?token=%s", repoOwner.Name, repo.Name, comment.ID, token)
124-
resp = session.MakeRequest(t, req, http.StatusOK)
124+
resp := session.MakeRequest(t, req, http.StatusOK)
125125

126126
var apiComment api.Comment
127127
DecodeJSON(t, resp, &apiComment)

integrations/api_issue_label_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func TestAPIModifyLabels(t *testing.T) {
8383

8484
//DeleteLabel
8585
req = NewRequest(t, "DELETE", singleURLStr)
86-
resp = session.MakeRequest(t, req, http.StatusNoContent)
86+
session.MakeRequest(t, req, http.StatusNoContent)
8787

8888
}
8989

@@ -203,6 +203,6 @@ func TestAPIModifyOrgLabels(t *testing.T) {
203203

204204
//DeleteLabel
205205
req = NewRequest(t, "DELETE", singleURLStr)
206-
resp = session.MakeRequest(t, req, http.StatusNoContent)
206+
session.MakeRequest(t, req, http.StatusNoContent)
207207

208208
}

integrations/api_issue_milestone_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,5 @@ func TestAPIIssuesMilestone(t *testing.T) {
7474
assert.Equal(t, int64(2), apiMilestones[0].ID)
7575

7676
req = NewRequest(t, "DELETE", fmt.Sprintf("/api/v1/repos/%s/%s/milestones/%d?token=%s", owner.Name, repo.Name, apiMilestone.ID, token))
77-
resp = session.MakeRequest(t, req, http.StatusNoContent)
77+
session.MakeRequest(t, req, http.StatusNoContent)
7878
}

integrations/api_issue_reaction_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,24 @@ func TestAPIIssuesReactions(t *testing.T) {
3636
req := NewRequestWithJSON(t, "POST", urlStr, &api.EditReactionOption{
3737
Reaction: "wrong",
3838
})
39-
resp := session.MakeRequest(t, req, http.StatusForbidden)
39+
session.MakeRequest(t, req, http.StatusForbidden)
4040

4141
//Delete not allowed reaction
4242
req = NewRequestWithJSON(t, "DELETE", urlStr, &api.EditReactionOption{
4343
Reaction: "zzz",
4444
})
45-
resp = session.MakeRequest(t, req, http.StatusOK)
45+
session.MakeRequest(t, req, http.StatusOK)
4646

4747
//Add allowed reaction
4848
req = NewRequestWithJSON(t, "POST", urlStr, &api.EditReactionOption{
4949
Reaction: "rocket",
5050
})
51-
resp = session.MakeRequest(t, req, http.StatusCreated)
51+
resp := session.MakeRequest(t, req, http.StatusCreated)
5252
var apiNewReaction api.Reaction
5353
DecodeJSON(t, resp, &apiNewReaction)
5454

5555
//Add existing reaction
56-
resp = session.MakeRequest(t, req, http.StatusForbidden)
56+
session.MakeRequest(t, req, http.StatusForbidden)
5757

5858
//Get end result of reaction list of issue #1
5959
req = NewRequestf(t, "GET", urlStr)
@@ -96,24 +96,24 @@ func TestAPICommentReactions(t *testing.T) {
9696
req := NewRequestWithJSON(t, "POST", urlStr, &api.EditReactionOption{
9797
Reaction: "wrong",
9898
})
99-
resp := session.MakeRequest(t, req, http.StatusForbidden)
99+
session.MakeRequest(t, req, http.StatusForbidden)
100100

101101
//Delete none existing reaction
102102
req = NewRequestWithJSON(t, "DELETE", urlStr, &api.EditReactionOption{
103103
Reaction: "eyes",
104104
})
105-
resp = session.MakeRequest(t, req, http.StatusOK)
105+
session.MakeRequest(t, req, http.StatusOK)
106106

107107
//Add allowed reaction
108108
req = NewRequestWithJSON(t, "POST", urlStr, &api.EditReactionOption{
109109
Reaction: "+1",
110110
})
111-
resp = session.MakeRequest(t, req, http.StatusCreated)
111+
resp := session.MakeRequest(t, req, http.StatusCreated)
112112
var apiNewReaction api.Reaction
113113
DecodeJSON(t, resp, &apiNewReaction)
114114

115115
//Add existing reaction
116-
resp = session.MakeRequest(t, req, http.StatusForbidden)
116+
session.MakeRequest(t, req, http.StatusForbidden)
117117

118118
//Get end result of reaction list of issue #1
119119
req = NewRequestf(t, "GET", urlStr)

integrations/api_notification_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func TestAPINotification(t *testing.T) {
6666
// -- GET /notifications/threads/{id} --
6767
// get forbidden
6868
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/notifications/threads/%d?token=%s", 1, token))
69-
resp = session.MakeRequest(t, req, http.StatusForbidden)
69+
session.MakeRequest(t, req, http.StatusForbidden)
7070

7171
// get own
7272
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/notifications/threads/%d?token=%s", thread5.ID, token))
@@ -100,7 +100,7 @@ func TestAPINotification(t *testing.T) {
100100

101101
lastReadAt := "2000-01-01T00%3A50%3A01%2B00%3A00" //946687801 <- only Notification 4 is in this filter ...
102102
req = NewRequest(t, "PUT", fmt.Sprintf("/api/v1/repos/%s/%s/notifications?last_read_at=%s&token=%s", user2.Name, repo1.Name, lastReadAt, token))
103-
resp = session.MakeRequest(t, req, http.StatusResetContent)
103+
session.MakeRequest(t, req, http.StatusResetContent)
104104

105105
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/notifications?status-types=unread&token=%s", token))
106106
resp = session.MakeRequest(t, req, http.StatusOK)
@@ -109,7 +109,7 @@ func TestAPINotification(t *testing.T) {
109109

110110
// -- PATCH /notifications/threads/{id} --
111111
req = NewRequest(t, "PATCH", fmt.Sprintf("/api/v1/notifications/threads/%d?token=%s", thread5.ID, token))
112-
resp = session.MakeRequest(t, req, http.StatusResetContent)
112+
session.MakeRequest(t, req, http.StatusResetContent)
113113

114114
assert.Equal(t, models.NotificationStatusUnread, thread5.Status)
115115
thread5 = unittest.AssertExistsAndLoadBean(t, &models.Notification{ID: 5}).(*models.Notification)

integrations/api_pull_review_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ func TestAPIPullReview(t *testing.T) {
140140
assert.EqualValues(t, "COMMENT", review.State)
141141
assert.EqualValues(t, 0, review.CodeCommentsCount)
142142
req = NewRequestf(t, http.MethodDelete, "/api/v1/repos/%s/%s/pulls/%d/reviews/%d?token=%s", repo.OwnerName, repo.Name, pullIssue.Index, review.ID, token)
143-
resp = session.MakeRequest(t, req, http.StatusNoContent)
143+
session.MakeRequest(t, req, http.StatusNoContent)
144144

145145
// test CreatePullReview Comment without body but with comments
146146
req = NewRequestWithJSON(t, http.MethodPost, fmt.Sprintf("/api/v1/repos/%s/%s/pulls/%d/reviews?token=%s", repo.OwnerName, repo.Name, pullIssue.Index, token), &api.CreatePullReviewOptions{

0 commit comments

Comments
 (0)