From eaf1a30145ae446166fd4bbf04ff6c57cf93bd4a Mon Sep 17 00:00:00 2001 From: yuenmichelle1 Date: Mon, 29 Apr 2024 10:49:32 -0500 Subject: [PATCH] allow setting private attribute of user_groups --- app/controllers/api/v1/user_groups_controller.rb | 4 ++-- spec/controllers/api/v1/user_groups_controller_spec.rb | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/controllers/api/v1/user_groups_controller.rb b/app/controllers/api/v1/user_groups_controller.rb index 9fa8194a2..5137b84b1 100644 --- a/app/controllers/api/v1/user_groups_controller.rb +++ b/app/controllers/api/v1/user_groups_controller.rb @@ -9,8 +9,8 @@ class Api::V1::UserGroupsController < Api::ApiController alias_method :user_group, :controlled_resource - allowed_params :create, :name, :display_name, :stats_visibility, links: [users: []] - allowed_params :update, :name, :stats_visibility, :display_name + allowed_params :create, :name, :display_name, :private, :stats_visibility, links: [users: []] + allowed_params :update, :name, :private, :stats_visibility, :display_name search_by do |name, query| search_names = name.join(' ').downcase diff --git a/spec/controllers/api/v1/user_groups_controller_spec.rb b/spec/controllers/api/v1/user_groups_controller_spec.rb index 92d50cdfb..9883578ab 100644 --- a/spec/controllers/api/v1/user_groups_controller_spec.rb +++ b/spec/controllers/api/v1/user_groups_controller_spec.rb @@ -106,7 +106,8 @@ let(:update_params) do { user_groups: { - display_name: 'A-Different-Name' + display_name: 'A-Different-Name', + private: false } } end @@ -193,7 +194,7 @@ describe '#create' do let(:test_attr) { :name } let(:test_attr_value) { 'Zooniverse' } - let(:create_params) { { user_groups: { name: 'Zooniverse' } } } + let(:create_params) { { user_groups: { name: 'Zooniverse', private: false } } } it_behaves_like 'is creatable'