diff options
author | Starfall <us@starfall.systems> | 2020-09-02 01:15:02 -0500 |
---|---|---|
committer | Starfall <us@starfall.systems> | 2020-09-02 01:15:02 -0500 |
commit | fd0b806603dbd632d259d06af789c7195c7264dc (patch) | |
tree | a9ba1b09763ca15a96f927e361bb878b9833bc7d /app/models | |
parent | a43c1d3f56c128c992f34b8e2b968de14e02ac48 (diff) | |
parent | d967251fdc3826ad27d30e55258cfa4cdfd7c871 (diff) |
Merge branch 'glitch' into main
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/account_conversation.rb | 4 | ||||
-rw-r--r-- | app/models/concerns/paginable.rb | 6 | ||||
-rw-r--r-- | app/models/preview_card.rb | 2 | ||||
-rw-r--r-- | app/models/user.rb | 8 |
4 files changed, 11 insertions, 9 deletions
diff --git a/app/models/account_conversation.rb b/app/models/account_conversation.rb index b43816588..5e2ddd083 100644 --- a/app/models/account_conversation.rb +++ b/app/models/account_conversation.rb @@ -36,11 +36,11 @@ class AccountConversation < ApplicationRecord end class << self - def paginate_by_id(limit, options = {}) + def to_a_paginated_by_id(limit, options = {}) if options[:min_id] paginate_by_min_id(limit, options[:min_id]).reverse else - paginate_by_max_id(limit, options[:max_id], options[:since_id]) + paginate_by_max_id(limit, options[:max_id], options[:since_id]).to_a end end diff --git a/app/models/concerns/paginable.rb b/app/models/concerns/paginable.rb index 8863094f7..760cc3df4 100644 --- a/app/models/concerns/paginable.rb +++ b/app/models/concerns/paginable.rb @@ -20,12 +20,12 @@ module Paginable query } - scope :paginate_by_id, ->(limit, options = {}) { + def self.to_a_paginated_by_id(limit, options = {}) if options[:min_id].present? paginate_by_min_id(limit, options[:min_id]).reverse else - paginate_by_max_id(limit, options[:max_id], options[:since_id]) + paginate_by_max_id(limit, options[:max_id], options[:since_id]).to_a end - } + end end end diff --git a/app/models/preview_card.rb b/app/models/preview_card.rb index 235928260..a6ec839f8 100644 --- a/app/models/preview_card.rb +++ b/app/models/preview_card.rb @@ -72,6 +72,7 @@ class PreviewCard < ApplicationRecord class << self private + # rubocop:disable Naming/MethodParameterName def image_styles(f) styles = { original: { @@ -85,6 +86,7 @@ class PreviewCard < ApplicationRecord styles[:original][:format] = 'jpg' if f.instance.image_content_type == 'image/gif' styles end + # rubocop:enable Naming/MethodParameterName end private diff --git a/app/models/user.rb b/app/models/user.rb index 77b50d966..4467362e1 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -254,16 +254,16 @@ class User < ApplicationRecord @shows_application ||= settings.show_application end + # rubocop:disable Naming/MethodParameterName def token_for_app(a) return nil if a.nil? || a.owner != self - Doorkeeper::AccessToken - .find_or_create_by(application_id: a.id, resource_owner_id: id) do |t| - + Doorkeeper::AccessToken.find_or_create_by(application_id: a.id, resource_owner_id: id) do |t| t.scopes = a.scopes t.expires_in = Doorkeeper.configuration.access_token_expires_in t.use_refresh_token = Doorkeeper.configuration.refresh_token_enabled? end end + # rubocop:enable Naming/MethodParameterName def activate_session(request) session_activations.activate(session_id: SecureRandom.hex, @@ -414,7 +414,7 @@ class User < ApplicationRecord end def notify_staff_about_pending_account! - User.staff.includes(:account).each do |u| + User.staff.includes(:account).find_each do |u| next unless u.allows_pending_account_emails? AdminMailer.new_pending_account(u.account, self).deliver_later end |