mirror of
https://framagit.org/tykayn/mastodon.git
synced 2023-08-25 08:33:12 +02:00
Fix account and tag searches with leading/trailing spaces (#5965)
* Strip leading & trailing spaces from account query * Strip leading & trailing spaces from tag search
This commit is contained in:
parent
98aa96b8d6
commit
6a82939adb
@ -23,7 +23,7 @@ class Tag < ApplicationRecord
|
|||||||
|
|
||||||
class << self
|
class << self
|
||||||
def search_for(term, limit = 5)
|
def search_for(term, limit = 5)
|
||||||
pattern = sanitize_sql_like(term) + '%'
|
pattern = sanitize_sql_like(term.strip) + '%'
|
||||||
Tag.where('lower(name) like lower(?)', pattern).order(:name).limit(limit)
|
Tag.where('lower(name) like lower(?)', pattern).order(:name).limit(limit)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -4,7 +4,7 @@ class AccountSearchService < BaseService
|
|||||||
attr_reader :query, :limit, :options, :account
|
attr_reader :query, :limit, :options, :account
|
||||||
|
|
||||||
def call(query, limit, account = nil, options = {})
|
def call(query, limit, account = nil, options = {})
|
||||||
@query = query
|
@query = query.strip
|
||||||
@limit = limit
|
@limit = limit
|
||||||
@options = options
|
@options = options
|
||||||
@account = account
|
@account = account
|
||||||
|
Loading…
Reference in New Issue
Block a user