Skip to content

Patch inactive user issue in V2 API - #3610

Merged
aaronskiba merged 5 commits into
developmentfrom
momo/v2-api-inactive-user-patch
Aug 21, 2026
Merged

Patch inactive user issue in V2 API#3610
aaronskiba merged 5 commits into
developmentfrom
momo/v2-api-inactive-user-patch

Conversation

@momo3404

@momo3404 momo3404 commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Changes proposed in this PR:

  • Add authorize_resource_owner function to V2 base_api_controller that checks if user is active and present before authorization.
  • Add render_error function to V2 API.
  • Create base_controller_spec for V2 base_api_controller.
  • Note for reviewers: This PR changes the error response shape for the v2 API — message has been removed and replaced with errors. Also worth flagging: the type changed too, not just the field name. message was an array of strings; errors is a plain string.
// Before
{ "code": 500, "message": ["There was a problem in the server."], "items": [] }

// After
{ "code": 500, "items": [], "errors": "There was a problem in the server." }

This is a breaking change for any consumer reading message off v2 error responses.

@aaronskiba

Copy link
Copy Markdown
Contributor

One test is breaking and it must be because you are calling render_error, but this repo does not yet define it (DMP Assistant added it here: portagenetwork@b1bd290).

@momo3404
momo3404 force-pushed the momo/v2-api-inactive-user-patch branch 2 times, most recently from bd50e66 to d78fe3a Compare August 11, 2026 20:05
Comment thread app/controllers/api/v2/base_api_controller.rb
@momo3404
momo3404 force-pushed the momo/v2-api-inactive-user-patch branch 3 times, most recently from c68b1b7 to b0a3361 Compare August 19, 2026 19:44
Comment thread app/views/api/v2/error.json.jbuilder
@momo3404
momo3404 force-pushed the momo/v2-api-inactive-user-patch branch 3 times, most recently from 89c9fee to 7b6f030 Compare August 21, 2026 20:56
- Function checks if resource owner is active and present before authorization, and returns error if not
- Move code assigning resource_owner to this new function for better readability
- Remove payload[:message], copying v1 behaviour
@momo3404
momo3404 force-pushed the momo/v2-api-inactive-user-patch branch from 7b6f030 to 10b6688 Compare August 21, 2026 21:08
@aaronskiba
aaronskiba merged commit 166686f into development Aug 21, 2026
9 checks passed
@momo3404
momo3404 deleted the momo/v2-api-inactive-user-patch branch August 21, 2026 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants