diff options
Diffstat (limited to 'app/controllers/users_controller.rb')
-rw-r--r-- | app/controllers/users_controller.rb | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 9546f71cd37..e4354eaa452 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -9,20 +9,21 @@ class UsersController < ApplicationController include Gitlab::NoteableMetadata requires_cross_project_access show: false, - groups: false, - projects: false, - contributed: false, - snippets: true, - calendar: false, - followers: false, - following: false, - calendar_activities: true + groups: false, + projects: false, + contributed: false, + snippets: true, + calendar: false, + followers: false, + following: false, + calendar_activities: true skip_before_action :authenticate_user! prepend_before_action(only: [:show]) { authenticate_sessionless_user!(:rss) } before_action :user, except: [:exists] - before_action :authorize_read_user_profile!, - only: [:calendar, :calendar_activities, :groups, :projects, :contributed, :starred, :snippets, :followers, :following] + before_action :authorize_read_user_profile!, only: [ + :calendar, :calendar_activities, :groups, :projects, :contributed, :starred, :snippets, :followers, :following + ] before_action only: [:exists] do check_rate_limit!(:username_exists, scope: request.ip) end @@ -71,7 +72,19 @@ class UsersController < ApplicationController format.json do load_events - pager_json("events/_events", @events.count, events: @events) + + if Feature.enabled?(:profile_tabs_vue, current_user) + @events = if user.include_private_contributions? + @events + else + @events.select { |event| event.visible_to_user?(current_user) } + end + + render json: ::Profile::EventSerializer.new(current_user: current_user, target_user: user) + .represent(@events) + else + pager_json("events/_events", @events.count, events: @events) + end end end end |