0
0
Fork 0

Extract constants for controller LIMIT queries (#32921)

This commit is contained in:
Matt Jankowski 2024-11-18 04:23:38 -05:00 committed by GitHub
parent 16addf47c7
commit c511cbcd6c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 12 additions and 4 deletions

View file

@ -5,6 +5,8 @@ class Settings::FeaturedTagsController < Settings::BaseController
before_action :set_featured_tag, except: [:index, :create]
before_action :set_recently_used_tags, only: :index
RECENT_TAGS_LIMIT = 10
def index
@featured_tag = FeaturedTag.new
end
@ -38,7 +40,7 @@ class Settings::FeaturedTagsController < Settings::BaseController
end
def set_recently_used_tags
@recently_used_tags = Tag.suggestions_for_account(current_account).limit(10)
@recently_used_tags = Tag.suggestions_for_account(current_account).limit(RECENT_TAGS_LIMIT)
end
def featured_tag_params

View file

@ -24,6 +24,8 @@ class Settings::ImportsController < Settings::BaseController
lists: false,
}.freeze
RECENT_IMPORTS_LIMIT = 10
def index
@import = Form::Import.new(current_account: current_account)
end
@ -96,6 +98,6 @@ class Settings::ImportsController < Settings::BaseController
end
def set_recent_imports
@recent_imports = current_account.bulk_imports.reorder(id: :desc).limit(10)
@recent_imports = current_account.bulk_imports.reorder(id: :desc).limit(RECENT_IMPORTS_LIMIT)
end
end