Skip to content

Commit 0df3b0e

Browse files
committed
Add task to enable the branch feature for a group
Add two tasks to enable and disable the branch feature for a specific group. Heavily inspired by #1645 Like the above PR, there are no tests.
1 parent e886ecc commit 0df3b0e

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

lib/tasks/groups.rake

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,24 @@ namespace :groups do
7171
Group.find_by(external_id: args[:group_id]).update!(file_upload_enabled: false)
7272
Rails.logger.info("Updated file_upload_enabled to false for group #{args[:group_id]}")
7373
end
74+
75+
desc "Enable branch_routing feature for group"
76+
task :enable_branch_routing, %i[group_id] => :environment do |_, args|
77+
usage_message = "usage: rake groups:enable_branch_routing[<group_external_id>]".freeze
78+
abort usage_message if args[:group_id].blank?
79+
80+
Group.find_by(external_id: args[:group_id]).update!(branch_routing_enabled: true)
81+
Rails.logger.info("Updated branch_routing_enabled to true for group #{args[:group_id]}")
82+
end
83+
84+
desc "Disable branch_routing feature for group"
85+
task :disable_branch_routing, %i[group_id] => :environment do |_, args|
86+
usage_message = "usage: rake groups:disable_branch_routing[<group_external_id>]".freeze
87+
abort usage_message if args[:group_id].blank?
88+
89+
Group.find_by(external_id: args[:group_id]).update!(branch_routing_enabled: false)
90+
Rails.logger.info("Updated branch_routing_enabled to false for group #{args[:group_id]}")
91+
end
7492
end
7593

7694
def run_task(task_name, args, rollback:)

0 commit comments

Comments
 (0)