Skip to content

Comments

mailer: pass request context to generateAdditionalHeadersForIssue#36274

Merged
wxiaoguang merged 3 commits intogo-gitea:mainfrom
luojiyin1987:mailer/fix-request-context
Jan 1, 2026
Merged

mailer: pass request context to generateAdditionalHeadersForIssue#36274
wxiaoguang merged 3 commits intogo-gitea:mainfrom
luojiyin1987:mailer/fix-request-context

Conversation

@luojiyin1987
Copy link
Contributor

@luojiyin1987 luojiyin1987 commented Jan 1, 2026

Fixes #36273

Use the caller-provided context when building X-Gitea-Issue-Link, instead of context.TODO().

Changes

  • Add ctx context.Context parameter to generateAdditionalHeadersForIssue
  • Rename misleading ctx parameter (was *mailComment) to comment for clarity
  • Update test to use t.Context()

   Replace context.TODO() with the actual request context to preserve
   trace and cancel signals when generating email headers.
Update test to use t.Context() for the new context parameter.
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jan 1, 2026
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Jan 1, 2026
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jan 1, 2026
@wxiaoguang
Copy link
Contributor

Replace context.TODO() with the actual request context to preserve trace and cancel signals when generating email headers.

The fix is right but the description is not related. There is no "request context trace" or "cancel signal" in this case.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jan 1, 2026
@wxiaoguang wxiaoguang enabled auto-merge (squash) January 1, 2026 04:02
@wxiaoguang wxiaoguang merged commit 98981eb into go-gitea:main Jan 1, 2026
24 checks passed
@GiteaBot GiteaBot added this to the 1.26.0 milestone Jan 1, 2026
@luojiyin1987 luojiyin1987 deleted the mailer/fix-request-context branch January 1, 2026 04:29
zjjhot added a commit to zjjhot/gitea that referenced this pull request Jan 5, 2026
* giteaofficial/main:
  Move assign project when creating pull request to the same database transaction (go-gitea#36244)
  [skip ci] Updated translations via Crowdin
  Fix stats bug when syncing release (go-gitea#36285)
  Fix link/origin referrer and login redirect (go-gitea#36279)
  Always honor user's choice for "delete branch after merge" (go-gitea#36281)
  refactor(pprof): use explicit mux instead of DefaultServeMux (go-gitea#36276)
  improve the compare page (go-gitea#36261)
  mailer: pass request context to generateAdditionalHeadersForIssue (go-gitea#36274)
  feat(debian): use explicit, stronger defaults for newly generated repo signing keys (go-gitea#36236)
  Make "commit statuses" API accept slashes in "ref" (go-gitea#36264)

# Conflicts:
#	templates/base/footer_content.tmpl
#	templates/base/head_navbar.tmpl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/go Pull requests that update Go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mailer: use context.TODO() loses trace information in email headers

4 participants