Skip to content

Commit a2cb492

Browse files
authored
Merge pull request #11176 from neinteractiveliterature/search-fixes
Don't attempt to show search results the user can't view
2 parents f657fef + 5555282 commit a2cb492

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# frozen_string_literal: true
22
class Types::SearchResultType < Types::BaseObject
3-
field :entries, [Types::SearchResultEntryType], null: false
4-
field :total_entries, Int, null: false
3+
description "A paginated search result containing matching entries and total count"
4+
5+
field :entries, [Types::SearchResultEntryType], null: false, description: "The results of the search"
6+
field :total_entries, Int, null: false, description: "The total number of entries matching the search query"
7+
8+
def entries
9+
object.entries.filter { |entry| policy(entry.model).read? }
10+
end
511
end

0 commit comments

Comments
 (0)