Skip to content

Organization push rules: execute read operations from `organization_push_rules` table

Implementation plan

We want to execute read operations using the new organization_push_rules table instead of push_rules. We want to introduce a way to redirect existing calls to the Global Push rule (is_sample = true) from the push_rules table to the new organization_push_rules.

To achieve this, we need to perform the following changes:

Pseudocode:

class PushRule < ApplicationRecord
  def self.global
    if Feature.enabled?(...)
       OrganizationPushRule.find_by(organization_id: Organizations::Organization::DEFAULT_ORGANIZATION_ID)
    else
      find_by(is_sample: true)
    end
  end

Pseudocode:

  def global?
    if Feature.enabled?(...)
      OrganizationPushRule.exists?(organization_id: organization_id)
    else
      is_sample?
    end
  end

Expectations

  • Both workflows should work as expected. The current behavior should be kept if the FF is off.
  • Validate that these are the only places where the Global push rule is called (using the push_rules and is_sample = true).
  • We should create separate issues to rollout and clean up the new FF.
Edited by Javiera Tapia