diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/models/status.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/app/models/status.rb b/app/models/status.rb index a2d64ecf0..8df4ab100 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -339,9 +339,15 @@ class Status < ApplicationRecord class << self def search_for(term, limit = 33, account = nil) return none if account.nil? + if term.start_with?('me:') + term = term.split(nil, 2)[1] + scope = account.statuses + else + scope = Status + end pattern = sanitize_sql_like(term) pattern = "#{pattern}" - scope = Status.without_reblogs.where("tsv @@ plainto_tsquery('english', ?)", pattern) + scope = scope.without_reblogs.where("tsv @@ plainto_tsquery('english', ?)", pattern) query = scope.where(account: account) .or(scope.where(account: account.following, visibility: [:private, :local, :unlisted])) .or(scope.where(id: account.mentions.select(:status_id))) |