about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorNick Schonning <nschonni@gmail.com>2023-02-18 06:39:00 -0500
committerGitHub <noreply@github.com>2023-02-18 12:39:00 +0100
commitab7816a4141e88cf7e05ba49638ee95fcc6f71ff (patch)
treed58529059d83b43c77042ed61b67de40327dd124 /app
parente2a3ebb271017d800a448ad3ef3e8324ac1fab3b (diff)
Autofix Rubocop Style/Lambda (#23696)
Diffstat (limited to 'app')
-rw-r--r--app/models/concerns/paginable.rb4
-rw-r--r--app/models/status.rb4
-rw-r--r--app/models/tag.rb2
3 files changed, 5 insertions, 5 deletions
diff --git a/app/models/concerns/paginable.rb b/app/models/concerns/paginable.rb
index 62e39f671..b76e78c1e 100644
--- a/app/models/concerns/paginable.rb
+++ b/app/models/concerns/paginable.rb
@@ -4,7 +4,7 @@ module Paginable
   extend ActiveSupport::Concern
 
   included do
-    scope :paginate_by_max_id, ->(limit, max_id = nil, since_id = nil) {
+    scope :paginate_by_max_id, lambda { |limit, max_id = nil, since_id = nil|
       query = order(arel_table[:id].desc).limit(limit)
       query = query.where(arel_table[:id].lt(max_id)) if max_id.present?
       query = query.where(arel_table[:id].gt(since_id)) if since_id.present?
@@ -14,7 +14,7 @@ module Paginable
     # Differs from :paginate_by_max_id in that it gives the results immediately following min_id,
     # whereas since_id gives the items with largest id, but with since_id as a cutoff.
     # Results will be in ascending order by id.
-    scope :paginate_by_min_id, ->(limit, min_id = nil, max_id = nil) {
+    scope :paginate_by_min_id, lambda { |limit, min_id = nil, max_id = nil|
       query = reorder(arel_table[:id]).limit(limit)
       query = query.where(arel_table[:id].gt(min_id)) if min_id.present?
       query = query.where(arel_table[:id].lt(max_id)) if max_id.present?
diff --git a/app/models/status.rb b/app/models/status.rb
index b1c49e99a..a924a985f 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -101,12 +101,12 @@ class Status < ApplicationRecord
   scope :including_silenced_accounts, -> { left_outer_joins(:account).where.not(accounts: { silenced_at: nil }) }
   scope :not_excluded_by_account, ->(account) { where.not(account_id: account.excluded_from_timeline_account_ids) }
   scope :not_domain_blocked_by_account, ->(account) { account.excluded_from_timeline_domains.blank? ? left_outer_joins(:account) : left_outer_joins(:account).where('accounts.domain IS NULL OR accounts.domain NOT IN (?)', account.excluded_from_timeline_domains) }
-  scope :tagged_with_all, ->(tag_ids) {
+  scope :tagged_with_all, lambda { |tag_ids|
     Array(tag_ids).map(&:to_i).reduce(self) do |result, id|
       result.joins("INNER JOIN statuses_tags t#{id} ON t#{id}.status_id = statuses.id AND t#{id}.tag_id = #{id}")
     end
   }
-  scope :tagged_with_none, ->(tag_ids) {
+  scope :tagged_with_none, lambda { |tag_ids|
     where('NOT EXISTS (SELECT * FROM statuses_tags forbidden WHERE forbidden.status_id = statuses.id AND forbidden.tag_id IN (?))', tag_ids)
   }
 
diff --git a/app/models/tag.rb b/app/models/tag.rb
index 47a05d00a..98001d60a 100644
--- a/app/models/tag.rb
+++ b/app/models/tag.rb
@@ -49,7 +49,7 @@ class Tag < ApplicationRecord
   scope :listable, -> { where(listable: [true, nil]) }
   scope :trendable, -> { Setting.trendable_by_default ? where(trendable: [true, nil]) : where(trendable: true) }
   scope :not_trendable, -> { where(trendable: false) }
-  scope :recently_used, ->(account) {
+  scope :recently_used, lambda { |account|
                           joins(:statuses)
                             .where(statuses: { id: account.statuses.select(:id).limit(1000) })
                             .group(:id).order(Arel.sql('count(*) desc'))