Skip to content

organisation user pins#953

Open
raphael-goetz wants to merge 10 commits into
mainfrom
#556-organisation-user-pins
Open

organisation user pins#953
raphael-goetz wants to merge 10 commits into
mainfrom
#556-organisation-user-pins

Conversation

@raphael-goetz
Copy link
Copy Markdown
Member

Resolves: #556

@raphael-goetz raphael-goetz self-assigned this May 4, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

GitLab Pipeline Action

General information

Link to pipeline: https://gitlab.com/code0-tech/development/sagittarius/-/pipelines/2516492791

Status: Passed
Duration: 7 minutes

Job summaries

rspec: [cloud]

Coverage report available at https://code0-tech.gitlab.io/-/development/sagittarius/-/jobs/14311790307/artifacts/tmp/coverage/index.html
Test summary available at https://gitlab.com/code0-tech/development/sagittarius/-/pipelines/2516492791/test_report
Finished in 22.81 seconds (files took 11.56 seconds to load)
1414 examples, 0 failures
Line Coverage: 92.54% (4542 / 4908)
[TEST PROF INFO] Time spent in factories: 00:12.789 (43.38% of total time)

rspec: [ee]

Coverage report available at https://code0-tech.gitlab.io/-/development/sagittarius/-/jobs/14311790305/artifacts/tmp/coverage/index.html
Test summary available at https://gitlab.com/code0-tech/development/sagittarius/-/pipelines/2516492791/test_report
Finished in 25.84 seconds (files took 11.86 seconds to load)
1392 examples, 0 failures
Line Coverage: 92.91% (4442 / 4781)
[TEST PROF INFO] Time spent in factories: 00:13.695 (42.42% of total time)

rspec: [ce]

Coverage report available at https://code0-tech.gitlab.io/-/development/sagittarius/-/jobs/14311790303/artifacts/tmp/coverage/index.html
Test summary available at https://gitlab.com/code0-tech/development/sagittarius/-/pipelines/2516492791/test_report
Finished in 17.87 seconds (files took 10.05 seconds to load)
1342 examples, 0 failures
Line Coverage: 92.43% (4271 / 4621)
[TEST PROF INFO] Time spent in factories: 00:09.950 (41.33% of total time)

docs:preview

Documentation preview available at https://code0-tech.gitlab.io/-/development/telescopium/-/jobs/14311848329/artifacts/out/index.html

rubocop

787 files inspected, no offenses detected

Comment thread app/graphql/mutations/users/update_organization_pins.rb Outdated
Comment thread app/graphql/types/user_organization_pin_type.rb Outdated
Comment thread app/graphql/types/user_type.rb Outdated
Copy link
Copy Markdown
Member

@Taucher2003 Taucher2003 left a comment

Choose a reason for hiding this comment

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

I think the Namespaces::Members::DeleteService should remove an organization pin when a user is removed from that organization.

Comment thread app/models/user.rb Outdated
Comment thread app/models/organization.rb Outdated
Comment thread app/models/user_organization_pin.rb Outdated
Comment thread app/policies/user_organization_pin_policy.rb Outdated
Comment thread app/policies/user_policy.rb Outdated
Comment thread app/services/users/update_organization_pins_service.rb Outdated
Comment thread app/services/users/update_organization_pins_service.rb Outdated
Comment thread app/services/users/update_organization_pins_service.rb Outdated
Comment thread spec/services/users/update_organization_pins_service_spec.rb
Comment thread app/services/users/update_organization_pins_service.rb Outdated
raphael-goetz and others added 5 commits May 11, 2026 17:06
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>
@raphael-goetz raphael-goetz marked this pull request as ready for review May 11, 2026 16:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_pins join table (+ model/associations) with priority ordering.
  • Adds Users::UpdateOrganizationPinsService and 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'
Comment on lines +45 to +52
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'

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.

Allow to pin organizations per user

3 participants