Skip to content

Commit 59c1e50

Browse files
authored
Merge pull request #950 from flippercloud/expression-sync
Expression sync
2 parents 8b3437e + 573705c commit 59c1e50

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

lib/flipper/adapters/sync/feature_synchronizer.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,13 @@ def call
5353
private
5454

5555
def sync_expression
56-
return if remote_expression.nil? || local_expression == remote_expression
56+
return if local_expression == remote_expression
5757

58-
@feature.enable_expression remote_expression
58+
if remote_expression.nil?
59+
@feature.disable_expression
60+
else
61+
@feature.enable_expression remote_expression
62+
end
5963
end
6064

6165
def sync_actors

spec/flipper/adapters/sync/feature_synchronizer_spec.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,10 @@
105105
expect_no_enable_or_disable
106106
end
107107

108-
it "updates expression when remote is updated to nil" do
109-
remote = Flipper::GateValues.new(expression: nil)
108+
it "updates expression when remote conditionally enabled but expression is nil" do
109+
remote = Flipper::GateValues.new(expression: nil, actors: Set["1"])
110110
feature.enable_expression(plan_expression)
111+
feature.enable_actor(Flipper::Actor.new("1"))
111112
adapter.reset
112113

113114
described_class.new(feature, feature.gate_values, remote).call

0 commit comments

Comments
 (0)