From ff92f8659a3b6e77ddbe0f64538e287431811196 Mon Sep 17 00:00:00 2001 From: Sean Arnold <sarnold@gitlab.com> Date: Fri, 10 Jan 2020 11:09:14 +1300 Subject: [PATCH] Move ability check to its own method --- app/finders/sentry_issues_finder.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/finders/sentry_issues_finder.rb b/app/finders/sentry_issues_finder.rb index f169fc9fca5..003c25922de 100644 --- a/app/finders/sentry_issues_finder.rb +++ b/app/finders/sentry_issues_finder.rb @@ -7,7 +7,7 @@ class SentryIssuesFinder end def find_by_identifier(identifier) - return unless Ability.allowed?(@current_user, :read_sentry_issue, @project) + return unless authorized? sentry_issue = SentryIssue.for_identifier(identifier).first @@ -15,4 +15,10 @@ class SentryIssuesFinder sentry_issue end + + private + + def authorized? + Ability.allowed?(@current_user, :read_sentry_issue, @project) + end end -- 2.30.9