organisation user pins#953
Conversation
GitLab Pipeline ActionGeneral informationLink to pipeline: https://gitlab.com/code0-tech/development/sagittarius/-/pipelines/2516492791 Status: Passed Job summariesrspec: [cloud]Coverage report available at https://code0-tech.gitlab.io/-/development/sagittarius/-/jobs/14311790307/artifacts/tmp/coverage/index.html rspec: [ee]Coverage report available at https://code0-tech.gitlab.io/-/development/sagittarius/-/jobs/14311790305/artifacts/tmp/coverage/index.html rspec: [ce]Coverage report available at https://code0-tech.gitlab.io/-/development/sagittarius/-/jobs/14311790303/artifacts/tmp/coverage/index.html docs:previewDocumentation preview available at https://code0-tech.gitlab.io/-/development/telescopium/-/jobs/14311848329/artifacts/out/index.html rubocop787 files inspected, no offenses detected |
Taucher2003
left a comment
There was a problem hiding this comment.
I think the Namespaces::Members::DeleteService should remove an organization pin when a user is removed from that organization.
Co-authored-by: Niklas van Schrick <mc.taucher2003@gmail.com> Signed-off-by: Raphael Götz <52959657+raphael-goetz@users.noreply.github.com>
Signed-off-by: Raphael Götz <52959657+raphael-goetz@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds per-user organization “pins” (ordered by priority) and exposes them via GraphQL, including persistence, authorization, and test coverage to satisfy Issue #556.
Changes:
- Introduces
user_organization_pinsjoin table (+ model/associations) withpriorityordering. - Adds
Users::UpdateOrganizationPinsServiceand GraphQL mutation/fields to update and query pins. - Updates policies, audit events/error codes, docs, and adds comprehensive specs/factories.
Reviewed changes
Copilot reviewed 34 out of 34 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| spec/services/users/update_organization_pins_service_spec.rb | Service specs for pin replacement, ordering, audit events, and failure paths |
| spec/services/namespaces/members/delete_service_spec.rb | Ensures org pin is removed when an org membership is deleted |
| spec/requests/graphql/mutation/users/update_organization_pins_spec.rb | Request spec for mutation behavior and error handling |
| spec/policies/user_policy_spec.rb | Adds coverage for update_user_organization_pin authorization |
| spec/policies/user_organization_pin_policy_spec.rb | Adds policy spec for reading pins (owner-only) |
| spec/models/user_spec.rb | Adds association expectations for pins/pinned orgs |
| spec/models/user_organization_pin_spec.rb | Adds model association/validation specs |
| spec/models/organization_spec.rb | Adds association expectations for pins/pinned-by users |
| spec/graphql/types/user_type_spec.rb | Ensures new GraphQL fields are present on User type |
| spec/graphql/types/user_organization_pin_type_spec.rb | Ensures new pin GraphQL type fields + auth are correct |
| spec/graphql/mutations/users/update_organization_pins_spec.rb | Basic mutation type naming spec |
| spec/factories/users.rb | Adds :with_organization_pins trait |
| spec/factories/user_organization_pins.rb | Adds factory for UserOrganizationPin |
| docs/graphql/scalar/userorganizationpinid.md | Adds scalar doc for pin global ID |
| docs/graphql/object/userorganizationpin.md | Adds docs for UserOrganizationPin GraphQL object |
| docs/graphql/object/user.md | Documents new organizationPins / pinnedOrganizations fields |
| docs/graphql/mutation/usersupdateorganizationpins.md | Documents new mutation |
| docs/graphql/enum/errorcodeenum.md | Documents new error code INVALID_USER_ORGANIZATION_PIN |
| db/structure.sql | Adds user_organization_pins table, indexes, and FKs |
| db/schema_migrations/20260504153000 | Tracks schema migration checksum |
| db/migrate/20260504153000_create_user_organization_pins.rb | Migration creating pins table with constraints/indexes |
| app/services/users/update_organization_pins_service.rb | Implements pin update/replace logic with audit + validation |
| app/services/namespaces/members/delete_service.rb | Deletes a user’s org pin when org membership is removed |
| app/services/error_code.rb | Registers invalid_user_organization_pin error code |
| app/policies/user_policy.rb | Adds update_user_organization_pin ability for self |
| app/policies/user_organization_pin_policy.rb | Owner-only read authorization for pin records |
| app/models/user.rb | Adds ordered pin association + pinned orgs association |
| app/models/user_organization_pin.rb | Adds join model + validations |
| app/models/organization.rb | Adds reverse associations from organization to pins/users |
| app/models/audit_event.rb | Adds new audit event type user_organization_pins_updated |
| app/graphql/types/user_type.rb | Adds organizationPins and pinnedOrganizations fields |
| app/graphql/types/user_organization_pin_type.rb | Adds GraphQL type for pin (with auth) |
| app/graphql/types/mutation_type.rb | Mounts the new mutation |
| app/graphql/mutations/users/update_organization_pins.rb | Implements GraphQL mutation to update user pins |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| authorize :read_user_organization_pin | ||
|
|
||
| field :organization, Types::OrganizationType, null: true, description: 'The pinned organization' |
| field :organization_pins, [Types::UserOrganizationPinType], | ||
| null: false, | ||
| description: 'Pinned organizations of this user with explicit priority' | ||
|
|
||
| field :pinned_organizations, [Types::OrganizationType], | ||
| null: false, | ||
| description: 'Pinned organizations of this user ordered by pin priority' | ||
|
|
Resolves: #556