-
-
Notifications
You must be signed in to change notification settings - Fork 835
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: move gambits to frontend (#3885) * refactor: move gambits to frontend * test: GambitManager * refactor: merge filterer and searcher concepts (#3892) * chore: drop remaining backend regex gambits * refactor: merge filterer & searcher concept * refactor: adapt extenders * refactor: no longer need to push gambits to `q` * refactor: filters to gambits * refactor: drop shred `Query` namespace * chore: cleanup * chore: leftover gambit references on the backend (#3894) * chore: leftover gambit references on the backend * chore: namespace * feat: search driver backend extension API (#3902) * feat: first iteration of search drivers * feat: indexer API & tweaks * feat: changes after POC driver * fix: properly fire custom observables * chore: remove debugging code * fix: phpstan * fix: custom eloquent events * chore: drop POC usage * test: indexer extender API * fix: extension searcher fails without filters * fix: phpstan * fix: frontend created gambit * feat: advanced page and localized driver settings (#3905) * feat: allow getting total search results and replacing filters (#3906) * feat: allow accessing total search results * feat: allow replacing filters * chore: phpstan
- Loading branch information
Showing
161 changed files
with
2,721 additions
and
2,184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as default } from '../common/extend'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import Extend from 'flarum/common/extenders'; | ||
import LockedGambit from './query/discussions/LockedGambit'; | ||
|
||
export default [ | ||
new Extend.Search() // | ||
.gambit('discussions', LockedGambit), | ||
]; |
23 changes: 23 additions & 0 deletions
23
extensions/lock/js/src/common/query/discussions/LockedGambit.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import IGambit from 'flarum/common/query/IGambit'; | ||
|
||
export default class LockedGambit implements IGambit { | ||
pattern(): string { | ||
return 'is:locked'; | ||
} | ||
|
||
toFilter(_matches: string[], negate: boolean): Record<string, any> { | ||
const key = (negate ? '-' : '') + 'locked'; | ||
|
||
return { | ||
[key]: true, | ||
}; | ||
} | ||
|
||
filterKey(): string { | ||
return 'locked'; | ||
} | ||
|
||
fromFilter(value: string, negate: boolean): string { | ||
return `${negate ? '-' : ''}is:locked`; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Flarum. | ||
* | ||
* For detailed copyright and license information, please view the | ||
* LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Flarum\Lock\Filter; | ||
|
||
use Flarum\Search\Database\DatabaseSearchState; | ||
use Flarum\Search\Filter\FilterInterface; | ||
use Flarum\Search\SearchState; | ||
use Illuminate\Database\Query\Builder; | ||
|
||
/** | ||
* @implements FilterInterface<DatabaseSearchState> | ||
*/ | ||
class LockedFilter implements FilterInterface | ||
{ | ||
public function getFilterKey(): string | ||
{ | ||
return 'locked'; | ||
} | ||
|
||
public function filter(SearchState $state, string|array $value, bool $negate): void | ||
{ | ||
$this->constrain($state->getQuery(), $negate); | ||
} | ||
|
||
protected function constrain(Builder $query, bool $negate): void | ||
{ | ||
$query->where('is_locked', ! $negate); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.