-
-
Notifications
You must be signed in to change notification settings - Fork 836
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: post search adapted with global search (#4019)
- Loading branch information
Showing
52 changed files
with
974 additions
and
188 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import Extend from 'flarum/common/extenders'; | ||
import LikedByGambit from './query/posts/LikedByGambit'; | ||
|
||
export default [ | ||
new Extend.Search() // | ||
.gambit('posts', LikedByGambit), | ||
]; |
16 changes: 16 additions & 0 deletions
16
extensions/likes/js/src/common/query/posts/LikedByGambit.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,16 @@ | ||
import { KeyValueGambit } from 'flarum/common/query/IGambit'; | ||
import app from 'flarum/common/app'; | ||
|
||
export default class LikedByGambit extends KeyValueGambit { | ||
key(): string { | ||
return app.translator.trans('flarum-likes.lib.gambits.posts.likedBy.key', {}, true); | ||
} | ||
|
||
hint(): string { | ||
return app.translator.trans('flarum-likes.lib.gambits.posts.likedBy.hint', {}, true); | ||
} | ||
|
||
filterKey(): string { | ||
return 'likedBy'; | ||
} | ||
} |
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,16 @@ | ||
import PostsUserPage from 'flarum/forum/components/PostsUserPage'; | ||
import type User from 'flarum/common/models/User'; | ||
|
||
/** | ||
* The `LikesUserPage` component shows posts which user the user liked. | ||
*/ | ||
export default class LikesUserPage extends PostsUserPage { | ||
params(user: User) { | ||
return { | ||
filter: { | ||
type: 'comment', | ||
likedBy: user.id(), | ||
}, | ||
}; | ||
} | ||
} |
24 changes: 0 additions & 24 deletions
24
extensions/likes/js/src/forum/components/LikesUserPage.tsx
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import commonExtend from '../common/extend'; | ||
|
||
export default [...commonExtend]; |
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 MentionedGambit from './query/posts/MentionedGambit'; | ||
|
||
export default [ | ||
new Extend.Search() // | ||
.gambit('posts', MentionedGambit), | ||
]; |
16 changes: 16 additions & 0 deletions
16
extensions/mentions/js/src/common/query/posts/MentionedGambit.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,16 @@ | ||
import { KeyValueGambit } from 'flarum/common/query/IGambit'; | ||
import app from 'flarum/common/app'; | ||
|
||
export default class MentionedGambit extends KeyValueGambit { | ||
key(): string { | ||
return app.translator.trans('flarum-mentions.lib.gambits.posts.mentioned.key', {}, true); | ||
} | ||
|
||
hint(): string { | ||
return app.translator.trans('flarum-mentions.lib.gambits.posts.mentioned.hint', {}, true); | ||
} | ||
|
||
filterKey(): string { | ||
return 'mentioned'; | ||
} | ||
} |
25 changes: 0 additions & 25 deletions
25
extensions/mentions/js/src/forum/components/MentionsUserPage.js
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
extensions/mentions/js/src/forum/components/MentionsUserPage.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,16 @@ | ||
import PostsUserPage from 'flarum/forum/components/PostsUserPage'; | ||
import type User from 'flarum/common/models/User'; | ||
|
||
/** | ||
* The `MentionsUserPage` component shows post which user Mentioned at | ||
*/ | ||
export default class MentionsUserPage extends PostsUserPage { | ||
params(user: User) { | ||
return { | ||
filter: { | ||
type: 'comment', | ||
mentioned: user.id(), | ||
}, | ||
}; | ||
} | ||
} |
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.