зеркало из https://github.com/github/octobox.git
Allow rejecting multiple statuses
This commit is contained in:
Родитель
276b8439c0
Коммит
c062031072
|
@ -6,7 +6,7 @@ module Octobox
|
|||
included do
|
||||
scope :unmuted, -> { where("muted_at IS NULL") }
|
||||
scope :exclude_type, ->(subject_type) { where.not(subject_type: subject_type) }
|
||||
scope :exclude_status, ->(status) { joins(:subject).where("subjects.status is NULL or subjects.status != ?", status) }
|
||||
scope :exclude_status, ->(status) { joins(:subject).where("subjects.status is NULL or subjects.status not in (?)", Array(status)) }
|
||||
scope :exclude_reason, ->(reason) { where.not(reason: reason) }
|
||||
scope :not_locked, -> { joins(:subject).where(subjects: { locked: false }) }
|
||||
scope :without_subject, -> { includes(:subject).where(subjects: { url: nil }) }
|
||||
|
|
|
@ -60,4 +60,9 @@ class SearchTest < ActiveSupport::TestCase
|
|||
search = Search.new(query: 'type:release archived:true', scope: Notification.all, params: {})
|
||||
assert_equal search.to_query, 'type:release archived:true'
|
||||
end
|
||||
|
||||
test 'Allow rejecting multiple statuses' do
|
||||
search = Search.new(query: '-status:merged -status:closed', scope: Notification.all, params: {})
|
||||
assert_equal search.results.length, 0
|
||||
end
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче