Skip to content

Commit

Permalink
Make sidekiq UI modifiable & Be rijbewijs improvements (#528)
Browse files Browse the repository at this point in the history
* chore(deps): update all non-major bundler dependencies

* Update Gemfile

* Update Gemfile

* moved factory bot to plugins rubocop

* generated gem.lock file

* intial commit

* fixed tests

* fixed test v2

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
  • Loading branch information
lodewiges and renovate[bot] authored Mar 9, 2025
1 parent 0f9e9f2 commit 8270046
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion app/controllers/v1/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def context

def excluded_display_properties
%i[created_at updated_at deleted_at activated_at archived_at password_digest activation_token
avatar activation_token_valid_till sidekiq_access setup_complete otp_secret_key otp_required
avatar activation_token_valid_till setup_complete otp_secret_key otp_required
ical_secret_key id]
end

Expand Down
11 changes: 6 additions & 5 deletions app/resources/v1/user_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class V1::UserResource < V1::ApplicationResource # rubocop:disable Metrics/Class
:picture_publication_preference, :ical_secret_key,
:password, :avatar, :avatar_url, :avatar_thumb_url,
:user_details_sharing_preference, :allow_sofia_sharing, :trailer_drivers_license,
:setup_complete
:sidekiq_access, :setup_complete

def avatar_url
@model.avatar.url
Expand Down Expand Up @@ -58,12 +58,13 @@ def fetchable_fields
allowed_keys += %i[login_enabled otp_required activated_at emergency_contact
emergency_number ifes_data_sharing_preference info_in_almanak
almanak_subscription_preference digtus_subscription_preference
user_details_sharing_preference allow_sofia_sharing trailer_drivers_license setup_complete]
user_details_sharing_preference allow_sofia_sharing
sidekiq_access setup_complete]
end
allowed_keys += %i[picture_publication_preference] if read_or_me?
if read_user_details? && !application_is_sofia?
allowed_keys += %i[email birthday address postcode city phone_number food_preferences vegetarian
study start_study]
study start_study trailer_drivers_license]
end
allowed_keys += %i[email birthday] if application_is_sofia? && @model.allow_sofia_sharing
super && allowed_keys
Expand All @@ -74,12 +75,12 @@ def self.creatable_fields(context) # rubocop:disable Metrics/MethodLength
attributes = %i[avatar nickname email address postcode city phone_number
food_preferences vegetarian study start_study
almanak_subscription_preference digtus_subscription_preference
emergency_contact emergency_number]
emergency_contact emergency_number trailer_drivers_license]
if me?(context)
attributes += %i[otp_required password
user_details_sharing_preference allow_sofia_sharing
picture_publication_preference info_in_almanak
ifes_data_sharing_preference trailer_drivers_license setup_complete]
ifes_data_sharing_preference sidekiq_access setup_complete]
end

if user_can_create_or_update?(context)
Expand Down
1 change: 1 addition & 0 deletions spec/factories/users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
password_confirmation { password }

otp_required { false }
sidekiq_access { false }
login_enabled { true }

transient do
Expand Down
9 changes: 5 additions & 4 deletions spec/requests/v1/users_controller/show_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
activated_at emergency_contact emergency_number info_in_almanak
almanak_subscription_preference digtus_subscription_preference
ifes_data_sharing_preference user_details_sharing_preference
trailer_drivers_license]
sidekiq_access]
end
end
end
Expand Down Expand Up @@ -63,7 +63,7 @@
activated_at emergency_contact emergency_number info_in_almanak
almanak_subscription_preference digtus_subscription_preference
ifes_data_sharing_preference user_details_sharing_preference
trailer_drivers_license]
sidekiq_access]
end
end
end
Expand All @@ -88,7 +88,8 @@
let(:record_permission) { nil }
let(:conditional_attributes) do
%w[picture_publication_preference email birthday address
postcode city phone_number food_preferences vegetarian study start_study]
postcode city phone_number food_preferences vegetarian study start_study
trailer_drivers_license]
end
end
end
Expand All @@ -104,7 +105,7 @@
city picture_publication_preference info_in_almanak
almanak_subscription_preference digtus_subscription_preference
emergency_contact emergency_number ifes_data_sharing_preference
user_details_sharing_preference trailer_drivers_license
user_details_sharing_preference trailer_drivers_license sidekiq_access
]
it_behaves_like '200 OK'
it {
Expand Down
3 changes: 2 additions & 1 deletion spec/requests/v1/users_controller/update_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
info_in_almanak almanak_subscription_preference
digtus_subscription_preference emergency_contact
emergency_number ifes_data_sharing_preference
user_details_sharing_preference trailer_drivers_license]
user_details_sharing_preference trailer_drivers_license
sidekiq_access]
permissible_attributes = %i[first_name last_name_prefix last_name birthday]

it_behaves_like 'a model with conditionally updatable attributes',
Expand Down
11 changes: 6 additions & 5 deletions spec/resources/v1/user_resource_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
%i[login_enabled otp_required activated_at emergency_contact
emergency_number ifes_data_sharing_preference info_in_almanak
almanak_subscription_preference digtus_subscription_preference
user_details_sharing_preference allow_sofia_sharing trailer_drivers_license
setup_complete]
user_details_sharing_preference allow_sofia_sharing
sidekiq_access setup_complete]
end
let(:read_fields) do
%i[picture_publication_preference]
end
let(:user_details_fields) do
%i[email birthday address postcode city phone_number food_preferences vegetarian
study start_study]
study start_study trailer_drivers_license]
end
let(:sofia_fields) do
%i[email birthday]
Expand Down Expand Up @@ -135,7 +135,8 @@
%i[avatar nickname email address postcode city phone_number
food_preferences vegetarian study start_study
almanak_subscription_preference
digtus_subscription_preference emergency_contact emergency_number]
digtus_subscription_preference emergency_contact emergency_number
trailer_drivers_license]
end
let(:permissible_fields) do
%i[first_name last_name_prefix last_name birthday
Expand All @@ -144,7 +145,7 @@
let(:current_user_fields) do
%i[otp_required password user_details_sharing_preference allow_sofia_sharing
info_in_almanak ifes_data_sharing_preference picture_publication_preference
trailer_drivers_license setup_complete]
sidekiq_access setup_complete]
end

context 'when without permission' do
Expand Down

0 comments on commit 8270046

Please sign in to comment.