Skip to content

Commit

Permalink
fix(search): Use OCP constants for filters
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen committed Nov 16, 2023
1 parent d7aee29 commit 3a6ec72
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions lib/Search/MessageSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
use OCP\IL10N;
use OCP\IURLGenerator;
use OCP\IUser;
use OCP\Search\IFilter;
use OCP\Search\IFilteringProvider;
use OCP\Search\IProvider;
use OCP\Search\ISearchQuery;
Expand Down Expand Up @@ -140,19 +141,19 @@ public function performSearch(IUser $user, ISearchQuery $query, string $title, a

// Apply filters when available
$lowerTimeBoundary = $upperTimeBoundary = $actorType = $actorId = null;
if ($since = $query->getFilter('since')?->get()) {
if ($since = $query->getFilter(IFilter::BUILTIN_SINCE)?->get()) {

Check failure on line 144 in lib/Search/MessageSearch.php

View workflow job for this annotation

GitHub Actions / Nextcloud

UndefinedConstant

lib/Search/MessageSearch.php:144:34: UndefinedConstant: Constant OCP\Search\IFilter::BUILTIN_SINCE is not defined (see https://psalm.dev/020)
if ($since instanceof \DateTimeImmutable) {
$lowerTimeBoundary = $since;
}
}

if ($until = $query->getFilter('until')?->get()) {
if ($until = $query->getFilter(IFilter::BUILTIN_UNTIL)?->get()) {

Check failure on line 150 in lib/Search/MessageSearch.php

View workflow job for this annotation

GitHub Actions / Nextcloud

UndefinedConstant

lib/Search/MessageSearch.php:150:34: UndefinedConstant: Constant OCP\Search\IFilter::BUILTIN_UNTIL is not defined (see https://psalm.dev/020)
if ($until instanceof \DateTimeImmutable) {
$upperTimeBoundary = $until;
}
}

if ($person = $query->getFilter('person')?->get()) {
if ($person = $query->getFilter(IFilter::BUILTIN_PERSON)?->get()) {

Check failure on line 156 in lib/Search/MessageSearch.php

View workflow job for this annotation

GitHub Actions / Nextcloud

UndefinedConstant

lib/Search/MessageSearch.php:156:35: UndefinedConstant: Constant OCP\Search\IFilter::BUILTIN_PERSON is not defined (see https://psalm.dev/020)
if ($person instanceof IUser) {
$actorType = Attendee::ACTOR_USERS;
$actorId = $person->getUID();
Expand Down Expand Up @@ -271,10 +272,10 @@ protected function commentToSearchResultEntry(Room $room, IUser $user, IComment

public function getSupportedFilters(): array {
return [
'term',
'since',
'until',
'person',
IFilter::BUILTIN_TERM,

Check failure on line 275 in lib/Search/MessageSearch.php

View workflow job for this annotation

GitHub Actions / Nextcloud

UndefinedConstant

lib/Search/MessageSearch.php:275:4: UndefinedConstant: Constant OCP\Search\IFilter::BUILTIN_TERM is not defined (see https://psalm.dev/020)
IFilter::BUILTIN_SINCE,

Check failure on line 276 in lib/Search/MessageSearch.php

View workflow job for this annotation

GitHub Actions / Nextcloud

UndefinedConstant

lib/Search/MessageSearch.php:276:4: UndefinedConstant: Constant OCP\Search\IFilter::BUILTIN_SINCE is not defined (see https://psalm.dev/020)
IFilter::BUILTIN_UNTIL,

Check failure on line 277 in lib/Search/MessageSearch.php

View workflow job for this annotation

GitHub Actions / Nextcloud

UndefinedConstant

lib/Search/MessageSearch.php:277:4: UndefinedConstant: Constant OCP\Search\IFilter::BUILTIN_UNTIL is not defined (see https://psalm.dev/020)
IFilter::BUILTIN_PERSON,

Check failure on line 278 in lib/Search/MessageSearch.php

View workflow job for this annotation

GitHub Actions / Nextcloud

UndefinedConstant

lib/Search/MessageSearch.php:278:4: UndefinedConstant: Constant OCP\Search\IFilter::BUILTIN_PERSON is not defined (see https://psalm.dev/020)
];
}

Expand Down

0 comments on commit 3a6ec72

Please sign in to comment.