Quellcode durchsuchen

Fix account and tag searches with leading/trailing spaces (#5965)

* Strip leading & trailing spaces from account query

* Strip leading & trailing spaces from tag search
master
Andrea Scarpino vor 6 Jahren
committed by Eugen Rochko
Ursprung
Commit
6a82939adb
2 geänderte Dateien mit 2 neuen und 2 gelöschten Zeilen
  1. +1
    -1
      app/models/tag.rb
  2. +1
    -1
      app/services/account_search_service.rb

+ 1
- 1
app/models/tag.rb Datei anzeigen

@@ -23,7 +23,7 @@ class Tag < ApplicationRecord

class << self
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)
end
end


+ 1
- 1
app/services/account_search_service.rb Datei anzeigen

@@ -4,7 +4,7 @@ class AccountSearchService < BaseService
attr_reader :query, :limit, :options, :account

def call(query, limit, account = nil, options = {})
@query = query
@query = query.strip
@limit = limit
@options = options
@account = account


Laden…
Abbrechen
Speichern