Merge commit '973597c6f1e25b16c592e5573304319aeaa375e1' into glitch-soc/merge-upstream

Conflicts:
- `app/validators/status_pin_validator.rb`:
  Upstream refactored that file, while glitch-soc had configurable limits for
  pinned statuses.
  Updated the code with upstream's refactor, while keeping glitch-soc's
  configurability.
This commit is contained in:
Claire committed 2023-12-19 20:51:37 +01:00
commit 2e786e13cb
157 files changed
+1283 -717

No files matched your search

+4 -2
View File
@@ -106,6 +106,8 @@ module AccountSearch
LIMIT :limit OFFSET :offset
SQL
DEFAULT_LIMIT = 10
def searchable_text
PlainTextFormatter.new(note, local?).to_s if discoverable?
end
@@ -118,7 +120,7 @@ module AccountSearch
end
class_methods do
def search_for(terms, limit: 10, offset: 0)
def search_for(terms, limit: DEFAULT_LIMIT, offset: 0)
tsquery = generate_query_for_search(terms)
find_by_sql([BASIC_SEARCH_SQL, { limit: limit, offset: offset, tsquery: tsquery }]).tap do |records|
@@ -126,7 +128,7 @@ module AccountSearch
end
end
def advanced_search_for(terms, account, limit: 10, following: false, offset: 0)
def advanced_search_for(terms, account, limit: DEFAULT_LIMIT, following: false, offset: 0)
tsquery = generate_query_for_search(terms)
sql_template = following ? ADVANCED_SEARCH_WITH_FOLLOWING : ADVANCED_SEARCH_WITHOUT_FOLLOWING