diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2018-08-27 18:31:01 +0300 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2018-09-11 18:32:00 +0300 |
commit | 2039c8280db1646845c33d6c5a74e5f23ca6f4de (patch) | |
tree | e2b3cd3012d9711cda7c6afb962ae4228d59521a /app/finders/user_recent_events_finder.rb | |
parent | 91c40973dc620430b173ea2df968587d2a708dff (diff) |
Disable existing offenses for the CodeReuse cops
This whitelists all existing offenses for the various CodeReuse cops, of
which most are triggered by the CodeReuse/ActiveRecord cop.
Diffstat (limited to 'app/finders/user_recent_events_finder.rb')
-rw-r--r-- | app/finders/user_recent_events_finder.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/finders/user_recent_events_finder.rb b/app/finders/user_recent_events_finder.rb index b874f6959c9..7405d6d27d9 100644 --- a/app/finders/user_recent_events_finder.rb +++ b/app/finders/user_recent_events_finder.rb @@ -21,6 +21,7 @@ class UserRecentEventsFinder @params = params end + # rubocop: disable CodeReuse/ActiveRecord def execute return Event.none unless can?(current_user, :read_user_profile, target_user) @@ -29,9 +30,11 @@ class UserRecentEventsFinder .with_associations .limit_recent(LIMIT, params[:offset]) end + # rubocop: enable CodeReuse/ActiveRecord private + # rubocop: disable CodeReuse/ActiveRecord def recent_events(offset) sql = <<~SQL (#{projects}) AS projects_for_join @@ -42,10 +45,13 @@ class UserRecentEventsFinder # Workaround for https://github.com/rails/rails/issues/24193 Event.from([Arel.sql(sql)]) end + # rubocop: enable CodeReuse/ActiveRecord + # rubocop: disable CodeReuse/ActiveRecord def target_events Event.where(author: target_user) end + # rubocop: enable CodeReuse/ActiveRecord def projects target_user.project_interactions.to_sql |