summaryrefslogtreecommitdiff
path: root/app/finders/events_finder.rb
diff options
context:
space:
mode:
authorGitLab Release Tools Bot <delivery-team+release-tools@gitlab.com>2020-07-01 16:56:42 +0000
committerGitLab Release Tools Bot <delivery-team+release-tools@gitlab.com>2020-07-01 16:56:42 +0000
commit132d2fd5cf7329a65237f93e97d16eb192a8d688 (patch)
tree0807d7d9ea9319f5349ff8a953c5eb02b69226ee /app/finders/events_finder.rb
parent2b0b97e746e327c6168505df7740e667b690a27f (diff)
parent2e7a6f64b07d018acbf2d42e5cc4c5224e4e8b42 (diff)
downloadgitlab-ce-132d2fd5cf7329a65237f93e97d16eb192a8d688.tar.gz
Merge remote-tracking branch 'dev/13-1-stable' into 13-1-stable
Diffstat (limited to 'app/finders/events_finder.rb')
-rw-r--r--app/finders/events_finder.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/finders/events_finder.rb b/app/finders/events_finder.rb
index 52612f1f8aa..004fbc4cd22 100644
--- a/app/finders/events_finder.rb
+++ b/app/finders/events_finder.rb
@@ -33,6 +33,8 @@ class EventsFinder
end
def execute
+ return Event.none if cannot_access_private_profile?
+
events = get_events
events = by_current_user_access(events)
@@ -103,6 +105,10 @@ class EventsFinder
end
# rubocop: enable CodeReuse/ActiveRecord
+ def cannot_access_private_profile?
+ source.is_a?(User) && !Ability.allowed?(current_user, :read_user_profile, source)
+ end
+
def sort(events)
return events unless params[:sort]