Skip to content

Commit 12f74d2

Browse files
committed
Update
1 parent 6f31288 commit 12f74d2

Some content is hidden

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

65 files changed

+99
-104
lines changed

modules/templates/helper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ func evalTokens(tokens ...any) (any, error) {
262262
return n.Value, err
263263
}
264264

265-
func userThemeName(ctx context.Context, user *user_model.User) string {
265+
func userThemeName(user *user_model.User) string {
266266
if user == nil || user.Theme == "" {
267267
return setting.UI.DefaultTheme
268268
}

modules/templates/util_date.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
package templates
55

66
import (
7-
"context"
87
"fmt"
98
"html"
109
"html/template"
@@ -36,8 +35,8 @@ func (du *DateUtils) FullTime(time any) template.HTML {
3635
return dateTimeFormat("full", time)
3736
}
3837

39-
func (du *DateUtils) TimeSince(ctx context.Context, time any) template.HTML {
40-
return TimeSince(ctx, time)
38+
func (du *DateUtils) TimeSince(time any) template.HTML {
39+
return TimeSince(time)
4140
}
4241

4342
// ParseLegacy parses the datetime in legacy format, eg: "2016-01-02" in server's timezone.
@@ -126,7 +125,7 @@ func timeSinceTo(then any, now time.Time) template.HTML {
126125
}
127126

128127
// TimeSince renders relative time HTML given a time
129-
func TimeSince(ctx context.Context, then any) template.HTML {
128+
func TimeSince(then any) template.HTML {
130129
if setting.UI.PreferredTimestampTense == "absolute" {
131130
return dateTimeFormat("full", then)
132131
}

modules/templates/util_date_legacy.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
package templates
55

66
import (
7-
"context"
87
"html/template"
98

109
"code.gitea.io/gitea/modules/translation"
@@ -18,7 +17,7 @@ func dateTimeLegacy(format string, datetime any, _ ...string) template.HTML {
1817
return dateTimeFormat(format, datetime)
1918
}
2019

21-
func timeSinceLegacy(ctx context.Context, time any, _ translation.Locale) template.HTML {
20+
func timeSinceLegacy(time any, _ translation.Locale) template.HTML {
2221
panicIfDevOrTesting()
23-
return TimeSince(ctx, time)
22+
return TimeSince(time)
2423
}

modules/templates/util_date_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,17 @@ func TestTimeSince(t *testing.T) {
5656
defer test.MockVariableValue(&setting.IsInTesting, false)()
5757

5858
du := NewDateUtils()
59-
assert.EqualValues(t, "-", du.TimeSince(t.Context(), nil))
59+
assert.EqualValues(t, "-", du.TimeSince(nil))
6060

6161
refTimeStr := "2018-01-01T00:00:00Z"
6262
refTime, _ := time.Parse(time.RFC3339, refTimeStr)
6363

64-
actual := du.TimeSince(t.Context(), refTime)
64+
actual := du.TimeSince(refTime)
6565
assert.EqualValues(t, `<relative-time prefix="" tense="past" datetime="2018-01-01T00:00:00Z" data-tooltip-content data-tooltip-interactive="true">2018-01-01 00:00:00 +00:00</relative-time>`, actual)
6666

6767
actual = timeSinceTo(&refTime, time.Time{})
6868
assert.EqualValues(t, `<relative-time prefix="" tense="future" datetime="2018-01-01T00:00:00Z" data-tooltip-content data-tooltip-interactive="true">2018-01-01 00:00:00 +00:00</relative-time>`, actual)
6969

70-
actual = timeSinceLegacy(t.Context(), timeutil.TimeStampNano(refTime.UnixNano()), nil)
70+
actual = timeSinceLegacy(timeutil.TimeStampNano(refTime.UnixNano()), nil)
7171
assert.EqualValues(t, `<relative-time prefix="" tense="past" datetime="2017-12-31T19:00:00-05:00" data-tooltip-content data-tooltip-interactive="true">2017-12-31 19:00:00 -05:00</relative-time>`, actual)
7272
}

routers/api/v1/repo/file.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ func GetEditorconfig(ctx *context.APIContext) {
384384
// "404":
385385
// "$ref": "#/responses/notFound"
386386

387-
ec, _, err := ctx.Repo.GetEditorconfig(ctx, ctx.Repo.Commit)
387+
ec, _, err := ctx.Repo.GetEditorconfig(ctx.Repo.Commit)
388388
if err != nil {
389389
if git.IsErrNotExist(err) {
390390
ctx.APIErrorNotFound(err)

routers/api/v1/repo/repo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1200,7 +1200,7 @@ func GetIssueTemplates(ctx *context.APIContext) {
12001200
// "$ref": "#/responses/IssueTemplates"
12011201
// "404":
12021202
// "$ref": "#/responses/notFound"
1203-
ret := issue.ParseTemplatesFromDefaultBranch(ctx, ctx.Repo.Repository, ctx.Repo.GitRepo)
1203+
ret := issue.ParseTemplatesFromDefaultBranch(ctx.Repo.Repository, ctx.Repo.GitRepo)
12041204
if cnt := len(ret.TemplateErrors); cnt != 0 {
12051205
ctx.Resp.Header().Add("X-Gitea-Warning", "error occurs when parsing issue template: count="+strconv.Itoa(cnt))
12061206
}

routers/api/v1/user/settings.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func GetUserSettings(ctx *context.APIContext) {
2424
// responses:
2525
// "200":
2626
// "$ref": "#/responses/UserSettings"
27-
ctx.JSON(http.StatusOK, convert.User2UserSettings(ctx, ctx.Doer))
27+
ctx.JSON(http.StatusOK, convert.User2UserSettings(ctx.Doer))
2828
}
2929

3030
// UpdateUserSettings returns user settings
@@ -61,5 +61,5 @@ func UpdateUserSettings(ctx *context.APIContext) {
6161
return
6262
}
6363

64-
ctx.JSON(http.StatusOK, convert.User2UserSettings(ctx, ctx.Doer))
64+
ctx.JSON(http.StatusOK, convert.User2UserSettings(ctx.Doer))
6565
}

routers/common/errpage.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ func RenderPanicErrorPage(w http.ResponseWriter, req *http.Request, err any) {
3939
tmplCtx["Locale"] = middleware.Locale(w, req)
4040
ctxData := middleware.GetContextData(req.Context())
4141

42-
ctxData["Ctx"] = req.Context()
43-
4442
// This recovery handler could be called without Gitea's web context, so we shouldn't touch that context too much.
4543
// Otherwise, the 500-page may cause new panics, eg: cache.GetContextWithData, it makes the developer&users couldn't find the original panic.
4644
user, _ := ctxData[middleware.ContextDataKeySignedUser].(*user_model.User)

routers/web/repo/blame.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ func renderBlame(ctx *context.Context, blameParts []*git.BlamePart, commitNames
278278
commitCnt++
279279

280280
// User avatar image
281-
commitSince := templates.TimeSince(ctx, commit.Author.When)
281+
commitSince := templates.TimeSince(commit.Author.When)
282282

283283
var avatar string
284284
if commit.User != nil {

routers/web/repo/editor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ func editFile(ctx *context.Context, isNewFile bool) {
201201

202202
// GetEditorConfig returns a editorconfig JSON string for given treePath or "null"
203203
func GetEditorConfig(ctx *context.Context, treePath string) string {
204-
ec, _, err := ctx.Repo.GetEditorconfig(ctx)
204+
ec, _, err := ctx.Repo.GetEditorconfig()
205205
if err == nil {
206206
def, err := ec.GetDefinitionForFilename(treePath)
207207
if err == nil {

0 commit comments

Comments
 (0)