From 2ce9f5267ac4c0301de955c44d3473a354b251dd Mon Sep 17 00:00:00 2001 From: Diego Viola Date: Mon, 6 Jan 2020 17:35:22 -0300 Subject: [PATCH 1/3] collection: differentiate owner accounts from staff-member owner accounts --- app/controllers/collection_controller.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/controllers/collection_controller.rb b/app/controllers/collection_controller.rb index ee57801937..b768ee2a23 100644 --- a/app/controllers/collection_controller.rb +++ b/app/controllers/collection_controller.rb @@ -88,6 +88,7 @@ def owners def add_owner @user.owner = true + @user.account_type = "Staff" @user.save! @collection.owners << @user @user.notification.owner_stats = true @@ -221,7 +222,15 @@ def create @collection = Collection.new @collection.title = params[:collection][:title] @collection.intro_block = params[:collection][:intro_block] - @collection.owner = current_user + if current_user.account_type != "Staff" + @collection.owner = current_user + else + current_user.collections.each do |c| + if c.owner.account_type != "Staff" + @collection.owner = c.owner + end + end + end if @collection.save flash[:notice] = 'Collection has been created' if request.referrer.include?('sc_collections') From fbcd5594bb04ed4a0b95e56a766dcc617e93dcf5 Mon Sep 17 00:00:00 2001 From: Diego Viola Date: Wed, 5 Feb 2020 00:56:18 -0300 Subject: [PATCH 2/3] collection: revert add_owner change --- app/controllers/collection_controller.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/controllers/collection_controller.rb b/app/controllers/collection_controller.rb index b768ee2a23..4cf7c9b2e5 100644 --- a/app/controllers/collection_controller.rb +++ b/app/controllers/collection_controller.rb @@ -88,7 +88,6 @@ def owners def add_owner @user.owner = true - @user.account_type = "Staff" @user.save! @collection.owners << @user @user.notification.owner_stats = true From 0086b7ebec9d1fea483264f057e5894030c60b26 Mon Sep 17 00:00:00 2001 From: Diego Viola Date: Fri, 14 Feb 2020 04:28:33 -0300 Subject: [PATCH 3/3] collection: set user account type to Staff --- app/controllers/collection_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/collection_controller.rb b/app/controllers/collection_controller.rb index 4cf7c9b2e5..b768ee2a23 100644 --- a/app/controllers/collection_controller.rb +++ b/app/controllers/collection_controller.rb @@ -88,6 +88,7 @@ def owners def add_owner @user.owner = true + @user.account_type = "Staff" @user.save! @collection.owners << @user @user.notification.owner_stats = true