mirror of
https://github.com/go-gitea/gitea
synced 2025-09-17 14:18:15 +00:00
Fix context usages (#35348)
This commit is contained in:
@@ -52,7 +52,7 @@ func Person(ctx *context.APIContext) {
|
||||
return
|
||||
}
|
||||
|
||||
person.URL = ap.IRI(ctx.ContextUser.HTMLURL())
|
||||
person.URL = ap.IRI(ctx.ContextUser.HTMLURL(ctx))
|
||||
|
||||
person.Icon = ap.Image{
|
||||
Type: ap.ImageType,
|
||||
|
@@ -111,9 +111,9 @@ func InitWebInstallPage(ctx context.Context) {
|
||||
mustInit(svg.Init)
|
||||
}
|
||||
|
||||
// InitWebInstalled is for global installed configuration.
|
||||
// InitWebInstalled is for the global configuration of an installed instance
|
||||
func InitWebInstalled(ctx context.Context) {
|
||||
mustInitCtx(ctx, git.InitFull)
|
||||
mustInit(git.InitFull)
|
||||
log.Info("Git version: %s (home: %s)", git.DefaultFeatures().VersionInfo(), git.HomeDir())
|
||||
if !git.DefaultFeatures().SupportHashSha256 {
|
||||
log.Warn("sha256 hash support is disabled - requires Git >= 2.42." + util.Iif(git.DefaultFeatures().UsingGogit, " Gogit is currently unsupported.", ""))
|
||||
|
@@ -97,7 +97,7 @@ func NewAuthSource(ctx *context.Context) {
|
||||
ctx.Data["AuthSources"] = authSources
|
||||
ctx.Data["SecurityProtocols"] = securityProtocols
|
||||
ctx.Data["SMTPAuths"] = smtp.Authenticators
|
||||
oauth2providers := oauth2.GetSupportedOAuth2ProvidersWithContext(ctx)
|
||||
oauth2providers := oauth2.GetSupportedOAuth2Providers(ctx)
|
||||
ctx.Data["OAuth2Providers"] = oauth2providers
|
||||
|
||||
ctx.Data["SSPIAutoCreateUsers"] = true
|
||||
@@ -242,7 +242,7 @@ func NewAuthSourcePost(ctx *context.Context) {
|
||||
ctx.Data["AuthSources"] = authSources
|
||||
ctx.Data["SecurityProtocols"] = securityProtocols
|
||||
ctx.Data["SMTPAuths"] = smtp.Authenticators
|
||||
oauth2providers := oauth2.GetSupportedOAuth2ProvidersWithContext(ctx)
|
||||
oauth2providers := oauth2.GetSupportedOAuth2Providers(ctx)
|
||||
ctx.Data["OAuth2Providers"] = oauth2providers
|
||||
|
||||
ctx.Data["SSPIAutoCreateUsers"] = true
|
||||
@@ -334,7 +334,7 @@ func EditAuthSource(ctx *context.Context) {
|
||||
|
||||
ctx.Data["SecurityProtocols"] = securityProtocols
|
||||
ctx.Data["SMTPAuths"] = smtp.Authenticators
|
||||
oauth2providers := oauth2.GetSupportedOAuth2Providers()
|
||||
oauth2providers := oauth2.GetSupportedOAuth2Providers(ctx)
|
||||
ctx.Data["OAuth2Providers"] = oauth2providers
|
||||
|
||||
source, err := auth.GetSourceByID(ctx, ctx.PathParamInt64("authid"))
|
||||
@@ -368,7 +368,7 @@ func EditAuthSourcePost(ctx *context.Context) {
|
||||
ctx.Data["PageIsAdminAuthentications"] = true
|
||||
|
||||
ctx.Data["SMTPAuths"] = smtp.Authenticators
|
||||
oauth2providers := oauth2.GetSupportedOAuth2Providers()
|
||||
oauth2providers := oauth2.GetSupportedOAuth2Providers(ctx)
|
||||
ctx.Data["OAuth2Providers"] = oauth2providers
|
||||
|
||||
source, err := auth.GetSourceByID(ctx, ctx.PathParamInt64("authid"))
|
||||
|
@@ -67,7 +67,7 @@ func TestNewAccessTokenResponse_OIDCToken(t *testing.T) {
|
||||
oidcToken = createAndParseToken(t, grants[0])
|
||||
assert.Equal(t, user.DisplayName(), oidcToken.Name)
|
||||
assert.Equal(t, user.Name, oidcToken.PreferredUsername)
|
||||
assert.Equal(t, user.HTMLURL(), oidcToken.Profile)
|
||||
assert.Equal(t, user.HTMLURL(t.Context()), oidcToken.Profile)
|
||||
assert.Equal(t, user.AvatarLink(db.DefaultContext), oidcToken.Picture)
|
||||
assert.Equal(t, user.Website, oidcToken.Website)
|
||||
assert.Equal(t, user.UpdatedUnix, oidcToken.UpdatedAt)
|
||||
|
@@ -103,7 +103,7 @@ func RenderUserSearch(ctx *context.Context, opts user_model.SearchUserOptions, t
|
||||
if isSitemap {
|
||||
m := sitemap.NewSitemap()
|
||||
for _, item := range users {
|
||||
m.Add(sitemap.URL{URL: item.HTMLURL(), LastMod: item.UpdatedUnix.AsTimePtr()})
|
||||
m.Add(sitemap.URL{URL: item.HTMLURL(ctx), LastMod: item.UpdatedUnix.AsTimePtr()})
|
||||
}
|
||||
ctx.Resp.Header().Set("Content-Type", "text/xml")
|
||||
if _, err := m.WriteTo(ctx.Resp); err != nil {
|
||||
|
@@ -54,7 +54,7 @@ func showUserFeed(ctx *context.Context, formatType string) {
|
||||
return
|
||||
}
|
||||
|
||||
rctx := renderhelper.NewRenderContextSimpleDocument(ctx, ctx.ContextUser.HTMLURL())
|
||||
rctx := renderhelper.NewRenderContextSimpleDocument(ctx, ctx.ContextUser.HTMLURL(ctx))
|
||||
ctxUserDescription, err := markdown.RenderString(rctx,
|
||||
ctx.ContextUser.Description)
|
||||
if err != nil {
|
||||
@@ -64,7 +64,7 @@ func showUserFeed(ctx *context.Context, formatType string) {
|
||||
|
||||
feed := &feeds.Feed{
|
||||
Title: ctx.Locale.TrString("home.feed_of", ctx.ContextUser.DisplayName()),
|
||||
Link: &feeds.Link{Href: ctx.ContextUser.HTMLURL()},
|
||||
Link: &feeds.Link{Href: ctx.ContextUser.HTMLURL(ctx)},
|
||||
Description: string(ctxUserDescription),
|
||||
Created: time.Now(),
|
||||
}
|
||||
|
@@ -85,7 +85,7 @@ func WebfingerQuery(ctx *context.Context) {
|
||||
}
|
||||
|
||||
aliases := []string{
|
||||
u.HTMLURL(),
|
||||
u.HTMLURL(ctx),
|
||||
appURL.String() + "api/v1/activitypub/user-id/" + strconv.FormatInt(u.ID, 10),
|
||||
}
|
||||
if !u.KeepEmailPrivate {
|
||||
@@ -96,7 +96,7 @@ func WebfingerQuery(ctx *context.Context) {
|
||||
{
|
||||
Rel: "http://webfinger.net/rel/profile-page",
|
||||
Type: "text/html",
|
||||
Href: u.HTMLURL(),
|
||||
Href: u.HTMLURL(ctx),
|
||||
},
|
||||
{
|
||||
Rel: "http://webfinger.net/rel/avatar",
|
||||
|
Reference in New Issue
Block a user