Skip to content

feat!: Support reason in UsersService.Unsuspend - #4614

Open
JamBalaya56562 wants to merge 1 commit into
google:masterfrom
JamBalaya56562:feat/4613-unsuspend-reason
Open

JamBalaya56562 wants to merge 1 commit into
google:masterfrom
JamBalaya56562:feat/4613-unsuspend-reason

Conversation

@JamBalaya56562

Copy link
Copy Markdown
Contributor

Fixes #4613.

BREAKING CHANGE: UsersService.Unsuspend now takes an UnsuspendUserRequest body argument.

The GHES Unsuspend a user endpoint (DELETE /users/{username}/suspended) accepts an optional reason that is recorded in the audit log, but Unsuspend always sent no body. This adds UnsuspendUserRequest{Reason *string} and passes it by value, matching Suspend. Pass UnsuspendUserRequest{} to unsuspend without a reason.

The new type follows the naming and value passing used for Suspend in #4612; the two PRs touch different parts of users_administration.go and can be merged in either order.

Verified locally: go build ./..., go vet -tags integration ./test/integration/, example module build, go test ./..., generated files idempotent, custom-gcl 0 issues, and script/check-schema-fields.sh reports no new issues.

@codecov

codecov Bot commented Oct 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.61%. Comparing base (e754d2c) to head (047621a).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4614   +/-   ##
=======================================
  Coverage   98.61%   98.61%           
=======================================
  Files         199      199           
  Lines       18693    18693           
=======================================
  Hits        18435    18435           
  Misses        258      258           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gmlewis gmlewis added NeedsReview PR is awaiting a review before merging. Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). labels Oct 12, 2026

@gmlewis gmlewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


// UnsuspendUserRequest represents a request to unsuspend a user.
type UnsuspendUserRequest struct {
Reason *string `json:"reason,omitempty"`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a comment documenting its default value?

The reason the user is being unsuspended. This message will be logged in the audit log. If you don't provide a reason, it will default to "Unsuspended via API by SITE_ADMINISTRATOR", where SITE_ADMINISTRATOR is the person who performed the action.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). NeedsReview PR is awaiting a review before merging.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support reason in UsersService.Unsuspend

3 participants