mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-18 02:21:47 -05:00
Fixed filter update after bulk action
no issue After making a change to a post via the bulk action menu, the filter checks if the post should still be included on the page. If not, it is removed. There were two bugs here: - Expansions were not applied - Relation checks were not working because the model was not serialized Now the posts correctly stay on the page if needed, or are removed if not.
This commit is contained in:
parent
a65dd11637
commit
ad3fc7fce3
1 changed files with 26 additions and 2 deletions
|
@ -247,13 +247,37 @@ export default class PostsContextMenu extends Component {
|
|||
updateFilteredPosts() {
|
||||
const updatedModels = this.selectionList.availableModels;
|
||||
const filter = this.selectionList.allFilter;
|
||||
const filterNql = nql(filter);
|
||||
const filterNql = nql(filter, {
|
||||
expansions: [
|
||||
{
|
||||
key: 'primary_tag',
|
||||
replacement: 'tags.slug',
|
||||
expansion: 'posts_tags.sort_order:0+tags.visibility:public'
|
||||
}, {
|
||||
key: 'primary_author',
|
||||
replacement: 'authors.slug',
|
||||
expansion: 'posts_authors.sort_order:0+authors.visibility:public'
|
||||
}, {
|
||||
key: 'authors',
|
||||
replacement: 'authors.slug'
|
||||
}, {
|
||||
key: 'author',
|
||||
replacement: 'authors.slug'
|
||||
}, {
|
||||
key: 'tag',
|
||||
replacement: 'tags.slug'
|
||||
}, {
|
||||
key: 'tags',
|
||||
replacement: 'tags.slug'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
const remainingModels = this.selectionList.infinityModel.content.filter((model) => {
|
||||
if (!updatedModels.find(u => u.id === model.id)) {
|
||||
return true;
|
||||
}
|
||||
return filterNql.queryJSON(model);
|
||||
return filterNql.queryJSON(model.serialize({includeId: true}));
|
||||
});
|
||||
// Deleteobjects method from infintiymodel is broken for all models except the first page, so we cannot use this
|
||||
this.infinity.replace(this.selectionList.infinityModel, remainingModels);
|
||||
|
|
Loading…
Add table
Reference in a new issue