[go: up one dir, main page]

Fill `organization_id` during PersonalSnippets creation process

Problem

See epic description: &13636 (closed)

Context

At the previous step Extend `snippets` table with `organization_id`... (#460825 - closed) we populated organization_id field with an ID of the default organization (id: 1).

In future, the organization will be taken from the user's scope. For that, we need to update the snippets creation process (Snippets::CreateService) to create personal snippets with a organization_id that matches snippet creator's organization.

Task

  1. Update Snippets::CreateService code to explicitly set organization_id for personal snippets creation process. For project snippets organization_id must be empty.
  2. Add a Rails validation to verify that organization_id is set for personal snippets.
  3. Verify that there are no other ways (apart from Snippets::CreateService) how personal snippet can be created.

MR

Set PersonalSnippet organization_id (!157768 - merged)

Edited by Hunter Stewart