Skip to content

Commit

Permalink
allow setting private attribute of user_groups
Browse files Browse the repository at this point in the history
  • Loading branch information
yuenmichelle1 committed Apr 29, 2024
1 parent 818e0d3 commit eaf1a30
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/controllers/api/v1/user_groups_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions spec/controllers/api/v1/user_groups_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@
let(:update_params) do
{
user_groups: {
display_name: 'A-Different-Name'
display_name: 'A-Different-Name',
private: false
}
}
end
Expand Down Expand Up @@ -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'

Expand Down

0 comments on commit eaf1a30

Please sign in to comment.