Skip to content

Commit

Permalink
Locks Dispatch Block to a FeatureToggle
Browse files Browse the repository at this point in the history
  • Loading branch information
lomky committed Aug 24, 2020
1 parent 7ac8b06 commit 96aac68
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 7 deletions.
6 changes: 5 additions & 1 deletion app/models/tasks/congressional_interest_mail_task.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# frozen_string_literal: true

class CongressionalInterestMailTask < MailTask
def self.blocking_distribution?
FeatureToggle.enabled?(:block_at_dispatch) ? false : true
end

def self.blocking_dispatch?
true
FeatureToggle.enabled?(:block_at_dispatch) ? true : false
end

def self.label
Expand Down
2 changes: 1 addition & 1 deletion app/models/tasks/foia_colocated_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def self.default_assignee
end

def self.blocking_dispatch?
true
FeatureToggle.enabled?(:block_at_dispatch) ? true : false
end

def hide_from_case_timeline
Expand Down
6 changes: 5 additions & 1 deletion app/models/tasks/foia_request_mail_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ def self.default_assignee(_parent)
PrivacyTeam.singleton
end

def self.blocking_distribution?
FeatureToggle.enabled?(:block_at_dispatch) ? false : true
end

def self.blocking_dispatch?
true
FeatureToggle.enabled?(:block_at_dispatch) ? true : false
end
end
2 changes: 1 addition & 1 deletion app/models/tasks/foia_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class FoiaTask < Task
def self.blocking_dispatch?
true
FeatureToggle.enabled?(:block_at_dispatch) ? true : false
end

def available_actions(user)
Expand Down
6 changes: 5 additions & 1 deletion app/models/tasks/privacy_act_request_mail_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ def self.default_assignee(_parent)
PrivacyTeam.singleton
end

def self.blocking_distribution?
FeatureToggle.enabled?(:block_at_dispatch) ? false : true
end

def self.blocking_dispatch?
true
FeatureToggle.enabled?(:block_at_dispatch) ? true : false
end
end
2 changes: 1 addition & 1 deletion app/models/tasks/privacy_act_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class PrivacyActTask < Task
def self.blocking_dispatch?
true
FeatureToggle.enabled?(:block_at_dispatch) ? true : false
end

def available_actions(user)
Expand Down
6 changes: 5 additions & 1 deletion app/models/tasks/privacy_complaint_mail_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ def self.default_assignee(_parent)
PrivacyTeam.singleton
end

def self.blocking_distribution?
FeatureToggle.enabled?(:block_at_dispatch) ? false : true
end

def self.blocking_dispatch?
true
FeatureToggle.enabled?(:block_at_dispatch) ? true : false
end
end
3 changes: 3 additions & 0 deletions spec/models/docket_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@
Colocated.singleton.add_user(user)
end

before { FeatureToggle.enable!(:block_at_dispatch) }
after { FeatureToggle.disable!(:block_at_dispatch) }

context "non distribution-blocking mail tasks" do
it "includes those appeals" do
nonblocking_appeal = create(:appeal,
Expand Down
3 changes: 3 additions & 0 deletions spec/models/task_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1705,6 +1705,9 @@ def next_assignee(_options = {})
let(:appeal) { create(:appeal) }
let(:task) { create(:task, appeal: appeal) }

before { FeatureToggle.enable!(:block_at_dispatch) }
after { FeatureToggle.disable!(:block_at_dispatch) }

it "does not block dispatch" do
expect(task.blocking_dispatch?).to be(false)
end
Expand Down
3 changes: 3 additions & 0 deletions spec/models/tasks/foia_task_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
let(:appeal) { create(:appeal) }
let(:task) { create(:foia_task, appeal: appeal) }

before { FeatureToggle.enable!(:block_at_dispatch) }
after { FeatureToggle.disable!(:block_at_dispatch) }

it "blocks dispatch" do
expect(task.blocking_dispatch?).to be(true)
end
Expand Down

0 comments on commit 96aac68

Please sign in to comment.