diff options
Diffstat (limited to 'app/services/users')
-rw-r--r-- | app/services/users/build_service.rb | 3 | ||||
-rw-r--r-- | app/services/users/dismiss_user_callout_service.rb | 11 | ||||
-rw-r--r-- | app/services/users/refresh_authorized_projects_service.rb | 13 |
3 files changed, 22 insertions, 5 deletions
diff --git a/app/services/users/build_service.rb b/app/services/users/build_service.rb index e3f02bf85f0..b3b172f9df2 100644 --- a/app/services/users/build_service.rb +++ b/app/services/users/build_service.rb @@ -83,7 +83,8 @@ module Users :location, :public_email, :user_type, - :note + :note, + :view_diffs_file_by_file ] end diff --git a/app/services/users/dismiss_user_callout_service.rb b/app/services/users/dismiss_user_callout_service.rb new file mode 100644 index 00000000000..f05c44186bb --- /dev/null +++ b/app/services/users/dismiss_user_callout_service.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Users + class DismissUserCalloutService < BaseContainerService + def execute + current_user.find_or_initialize_callout(params[:feature_name]).tap do |callout| + callout.update(dismissed_at: Time.current) if callout.valid? + end + end + end +end diff --git a/app/services/users/refresh_authorized_projects_service.rb b/app/services/users/refresh_authorized_projects_service.rb index 24e3fb73370..070713929e4 100644 --- a/app/services/users/refresh_authorized_projects_service.rb +++ b/app/services/users/refresh_authorized_projects_service.rb @@ -92,7 +92,7 @@ module Users # remove - The IDs of the authorization rows to remove. # add - Rows to insert in the form `[user id, project id, access level]` def update_authorizations(remove = [], add = []) - log_refresh_details(remove.length, add.length) + log_refresh_details(remove, add) User.transaction do user.remove_project_authorizations(remove) unless remove.empty? @@ -104,11 +104,16 @@ module Users user.reset end - def log_refresh_details(rows_deleted, rows_added) + def log_refresh_details(remove, add) Gitlab::AppJsonLogger.info(event: 'authorized_projects_refresh', + user_id: user.id, 'authorized_projects_refresh.source': source, - 'authorized_projects_refresh.rows_deleted': rows_deleted, - 'authorized_projects_refresh.rows_added': rows_added) + 'authorized_projects_refresh.rows_deleted_count': remove.length, + 'authorized_projects_refresh.rows_added_count': add.length, + # most often there's only a few entries in remove and add, but limit it to the first 5 + # entries to avoid flooding the logs + 'authorized_projects_refresh.rows_deleted_slice': remove.first(5), + 'authorized_projects_refresh.rows_added_slice': add.first(5)) end def fresh_access_levels_per_project |