Skip to content

Show services not active when not persisted

Andy Schoenen requested to merge show_unpersisted_services_not_active into master

What does this MR do?

We initialize all service models on the project settings services page. If there is no record for a service but a template exists, we initialize it with values from the template. This makes the service appear as active in the list, even though it is not saved yet.

Screenshots

Screenshot_2020-04-22_at_16.03.58

JiraService.where(template: false).count
   (1.0ms)  SELECT COUNT(*) FROM "services" WHERE "services"."type" = 'JiraService' AND "services"."template" = FALSE
=> 0

(The database has just the template service)

How to reproduce the bug

  1. Go to the admin Service Templates page
  2. Choose one service and add some settings but don't activate it.
  3. Create a new project
  4. Go back to the admin Service Templates page and activate the service template
  5. Go to the new project Settings > Integrations page.
  6. The service shows the green active dot but there is no service record with this project_id in the database.

Note: The active checkbox is currently broken: #215041 (closed)

How to test on staging

This MR can't be tested on staging because it requires an active service template. The template would be propagated to all projects on staging and might cause problems. So this needs to be tested locally

Follow the steps in How to reproduce the bug but make sure the green active dot doesn't show up on the project integrations page

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team
Edited by 🤖 GitLab Bot 🤖

Merge request reports