mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-05 07:19:14 +00:00
Set connected apps as enabled if any
Could have easily done this manually, but this makes the transition smoother. BTW I tested each case manually, didn't seem worth writing a spec.
This commit is contained in:
committed by
Rachel Arnould
parent
5d732d80a6
commit
bd48a982fb
@@ -0,0 +1,14 @@
|
||||
class SetConnectedAppsEnabledIfAny < ActiveRecord::Migration[7.0]
|
||||
def up
|
||||
enabled = []
|
||||
enabled << "discover_regen" if ConnectedApp.discover_regen.any?
|
||||
enabled << "affiliate_sales_data" if ConnectedApp.affiliate_sales_data.any?
|
||||
|
||||
Spree::Config.connected_apps_enabled = enabled.presence&.join(",")
|
||||
end
|
||||
end
|
||||
|
||||
class ConnectedApp < ApplicationRecord
|
||||
scope :discover_regen, -> { where(type: "ConnectedApp") }
|
||||
scope :affiliate_sales_data, -> { where(type: "ConnectedApps::AffiliateSalesData") }
|
||||
end
|
||||
Reference in New Issue
Block a user