mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-04 22:16:08 +00:00
When registering a new enterprise, if user is signed in, owns a hub and is not making a producer, the new enterprise becomes a hub
This commit is contained in:
@@ -63,7 +63,9 @@ module Api
|
||||
end
|
||||
|
||||
def override_sells
|
||||
params[:enterprise][:sells] = 'unspecified'
|
||||
has_hub = current_api_user.enterprises.is_hub.any?
|
||||
new_enterprise_is_producer = !!params[:enterprise][:is_primary_producer]
|
||||
params[:enterprise][:sells] = (has_hub && !new_enterprise_is_producer) ? 'any' : 'unspecified'
|
||||
end
|
||||
|
||||
def override_visible
|
||||
|
||||
Reference in New Issue
Block a user