Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow setting private attribute of user_groups on create and update #4320

Merged
merged 1 commit into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading