Show services not active when not persisted
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
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
- Go to the admin Service Templates page
- Choose one service and add some settings but don't activate it.
- Create a new project
- Go back to the admin Service Templates page and activate the service template
- Go to the new project Settings > Integrations page.
- 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
-
Changelog entry - [-] Documentation (if required)
-
Code review guidelines - [ x Merge request performance guidelines
-
Style guides - [-] Database guides
- [-] Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. - [-] Tested in all supported browsers
- [-] Informed Infrastructure department of a default or new setting change, if applicable per definition of done
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