fix: Propagate review filtered status (#2370)
This commit is contained in:
@@ -167,13 +167,16 @@ export class AdvancedCameraCardThumbnailFeature extends LitElement {
|
||||
}}
|
||||
@click=${async (ev: Event) => {
|
||||
stopEventFromActivatingCardWideActions(ev);
|
||||
if (this.item) {
|
||||
await toggleReviewed(
|
||||
if (
|
||||
this.item &&
|
||||
(await toggleReviewed(
|
||||
this.item,
|
||||
this.viewItemManager,
|
||||
this.viewManagerEpoch,
|
||||
this.filterReviewed,
|
||||
);
|
||||
))
|
||||
) {
|
||||
this.requestUpdate();
|
||||
}
|
||||
}}
|
||||
></advanced-camera-card-icon>`
|
||||
|
||||
@@ -355,9 +355,11 @@ export class UnifiedQueryBuilder {
|
||||
return null;
|
||||
}
|
||||
|
||||
return this._buildQueryNodesCapabilityUnchecked(spec, cameraID, {
|
||||
limit: options?.limit,
|
||||
});
|
||||
return this._buildQueryNodesCapabilityUnchecked(
|
||||
spec,
|
||||
cameraID,
|
||||
this._resolveReviewedFilter(spec, cameraID, options),
|
||||
);
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
@@ -399,21 +401,13 @@ export class UnifiedQueryBuilder {
|
||||
continue;
|
||||
}
|
||||
|
||||
// For reviews, resolve the reviewed filter from camera config if not provided
|
||||
const resolvedOptions =
|
||||
cameraSpec.mediaType === 'reviews' && options?.reviewed === undefined
|
||||
? {
|
||||
...options,
|
||||
reviewed: getReviewedQueryFilterFromConfig(
|
||||
this._cameraManager.getStore().getCameraConfig(cameraID)?.media
|
||||
?.reviewed,
|
||||
),
|
||||
}
|
||||
: options;
|
||||
|
||||
this._addNode(
|
||||
query,
|
||||
this._buildQueryNodesCapabilityUnchecked(cameraSpec, cameraID, resolvedOptions),
|
||||
this._buildQueryNodesCapabilityUnchecked(
|
||||
cameraSpec,
|
||||
cameraID,
|
||||
this._resolveReviewedFilter(cameraSpec, cameraID, options),
|
||||
),
|
||||
);
|
||||
}
|
||||
return query.hasNodes() ? query : null;
|
||||
@@ -530,6 +524,22 @@ export class UnifiedQueryBuilder {
|
||||
};
|
||||
}
|
||||
|
||||
private _resolveReviewedFilter(
|
||||
spec: MediaTypeSpec,
|
||||
cameraID: string,
|
||||
options?: QueryFiltersOptions,
|
||||
): QueryFiltersOptions | undefined {
|
||||
if (spec.mediaType !== 'reviews' || options?.reviewed !== undefined) {
|
||||
return options;
|
||||
}
|
||||
return {
|
||||
...options,
|
||||
reviewed: getReviewedQueryFilterFromConfig(
|
||||
this._cameraManager.getStore().getCameraConfig(cameraID)?.media?.reviewed,
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
private _extractFilterOptions(options?: QueryFilters): QueryFilters {
|
||||
return {
|
||||
...(options?.favorite !== undefined && { favorite: options.favorite }),
|
||||
|
||||
Reference in New Issue
Block a user