forked from DebaucheryLibrarian/traxxx
Added basic co-star actor filter to actor page.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import config from 'config';
|
||||
import { graphql, get } from '../api';
|
||||
import { releaseFields, getIncludedEntities } from '../fragments';
|
||||
import { releaseFields, getIncludedEntities, getIncludedActors } from '../fragments';
|
||||
import { curateActor, curateRelease } from '../curate';
|
||||
import getDateRange from '../get-date-range';
|
||||
|
||||
@@ -26,7 +26,8 @@ function initActorActions(store, router) {
|
||||
$selectableTags: [String],
|
||||
$includedTags: [String!],
|
||||
$mode: String!,
|
||||
$includedEntities: [ReleaseFilter!]
|
||||
$includedEntities: [ReleaseFilter!],
|
||||
$includedActors: [ReleaseFilter!]
|
||||
) {
|
||||
actor(id: $actorId) {
|
||||
id
|
||||
@@ -160,13 +161,25 @@ function initActorActions(store, router) {
|
||||
type
|
||||
}
|
||||
}
|
||||
actors {
|
||||
id
|
||||
name
|
||||
slug
|
||||
}
|
||||
scenesConnection(
|
||||
filter: {
|
||||
date: {
|
||||
lessThan: $before,
|
||||
greaterThan: $after,
|
||||
}
|
||||
or: $includedEntities
|
||||
and: [
|
||||
{
|
||||
or: $includedEntities
|
||||
}
|
||||
{
|
||||
or: $includedActors
|
||||
}
|
||||
]
|
||||
}
|
||||
selectedTags: $includedTags
|
||||
mode: $mode
|
||||
@@ -192,6 +205,7 @@ function initActorActions(store, router) {
|
||||
excludeTags: store.state.ui.filter,
|
||||
includedTags,
|
||||
includedEntities: getIncludedEntities(router),
|
||||
includedActors: getIncludedActors(router),
|
||||
mode,
|
||||
});
|
||||
|
||||
|
||||
@@ -360,6 +360,27 @@ function getIncludedEntities(router) {
|
||||
];
|
||||
}
|
||||
|
||||
function getIncludedActors(router) {
|
||||
const includedActors = router.currentRoute.query.actors ? router.currentRoute.query.actors.split(',') : [];
|
||||
|
||||
if (includedActors.length === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [
|
||||
{
|
||||
releasesActorsConnection: {
|
||||
some: {
|
||||
actor: {
|
||||
slug: {
|
||||
in: includedActors,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
export {
|
||||
releaseActorsFragment,
|
||||
@@ -373,4 +394,5 @@ export {
|
||||
siteFragment,
|
||||
sitesFragment,
|
||||
getIncludedEntities,
|
||||
getIncludedActors,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user