def index
@search = Search.new(search_results)
render json: @search, serializer: REST::SearchSerializer
- rescue Mastodon::SyntaxError
- unprocessable_entity
- rescue ActiveRecord::RecordNotFound
- not_found
end
private
case prefix
when 'from'
@filter = :account_id
+ username, domain = term.split('@')
+ account = Account.find_remote(username, domain)
- username, domain = term.gsub(/\A@/, '').split('@')
- domain = nil if TagManager.instance.local_domain?(domain)
- account = Account.find_remote!(username, domain)
+ raise "Account not found: #{term}" unless account
@term = account.id
else
- raise Mastodon::SyntaxError
+ raise "Unknown prefix: #{prefix}"
end
end
end
class StreamValidationError < ValidationError; end
class RaceConditionError < Error; end
class RateLimitExceededError < Error; end
- class SyntaxError < Error; end
class UnexpectedResponseError < Error
attr_reader :response