Organization push rules: stop updating push_rules table

Implementation plan

We should stop updating the push_rules table when defined globally (is_sample == true). Now, we should start updating the new organization_push_rules table. For this purpose, we should apply the following changes:

  • Use a new FF (i.e update_organization_push_rules) to control the updates of organization_push_rules in ee/app/controllers/admin/push_rules_controller.rb.

  • In ee/app/controllers/admin/push_rules_controller.rb we should use something like the following (untested code):

      def push_rule
        if Feature.enabled?(:update_organization_push_rules, organization)
          @push_rule ||= OrganizationPushRule.find_or_initialize_by(organization_id: Organizations::Organization::DEFAULT_ORGANIZATION_ID)
        else
          @push_rule ||= PushRule.find_or_initialize_by(is_sample: true)
        end
      end
    • Validate that the organization exists in the database. Otherwise, render a corresponding 404 .

Expectations

  • The output of Admin::PushRulesController#update should remain the same. We are changing the underlying logic to populate the organization_push_rule table.
  • Introduce a new FF (i.e :update_organization_push_rules). If the FF is off then we should continue using the old implementation.
  • Create the rollout and cleanup issues for the new FF (i.e :update_organization_push_rules).
  • Provide enough tests to cover the new implementation and ensure there are no regressions introduced when the FF is off.
Edited by 🤖 GitLab Bot 🤖