Added entity reporting.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import { computed, inject, ref } from 'vue';
|
||||
|
||||
import Domains from '#/components/domains/domains.vue';
|
||||
import ReportDialog from '#/components/entities/report.vue';
|
||||
import EntityTile from '#/components/entities/tile.vue';
|
||||
import Movies from '#/components/movies/movies.vue';
|
||||
import Scenes from '#/components/scenes/scenes.vue';
|
||||
@@ -10,6 +11,9 @@ import Heart from '#/components/stashes/heart.vue';
|
||||
const { pageProps, routeParams, user } = inject('pageContext');
|
||||
const { entity } = pageProps;
|
||||
|
||||
const isReported = ref(pageProps.isReported);
|
||||
const showReportDialog = ref(false);
|
||||
|
||||
const children = ref(null);
|
||||
const expanded = ref(false);
|
||||
|
||||
@@ -77,8 +81,32 @@ const entityUrl = entity.affiliateUrl || entity.url || null;
|
||||
:item="entity"
|
||||
class="light"
|
||||
/>
|
||||
|
||||
<template v-if="user">
|
||||
<Icon
|
||||
v-if="isReported"
|
||||
v-tooltip="`Your report for this ${entity.type} is awaiting review`"
|
||||
icon="warning2"
|
||||
class="report reported"
|
||||
/>
|
||||
|
||||
<Icon
|
||||
v-else
|
||||
v-tooltip="`Report a problem with '${entity.name}'`"
|
||||
icon="warning2"
|
||||
class="report"
|
||||
@click="showReportDialog = true"
|
||||
/>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<ReportDialog
|
||||
v-if="showReportDialog"
|
||||
:entity="entity"
|
||||
@reported="showReportDialog = false; isReported = true;"
|
||||
@close="showReportDialog = false"
|
||||
/>
|
||||
|
||||
<Domains
|
||||
:domain="domain"
|
||||
:path="`/${entity.type}/${entity.slug}`"
|
||||
@@ -319,6 +347,24 @@ const entityUrl = entity.affiliateUrl || entity.url || null;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.report {
|
||||
width: 1.1rem;
|
||||
height: 100%;
|
||||
padding: 0 1rem;
|
||||
margin: -0.25rem 0 0 .75rem;
|
||||
fill: var(--highlight-weak-10);
|
||||
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
fill: var(--warn);
|
||||
}
|
||||
|
||||
&.reported {
|
||||
fill: var(--primary);
|
||||
cursor: default;
|
||||
}
|
||||
}
|
||||
|
||||
.plainurl {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
|
||||
@@ -5,6 +5,7 @@ import { getCampaignIndex, getRandomCampaigns } from '#/src/campaigns.js';
|
||||
import entityPrefixes from '#/src/entities-prefixes.js';
|
||||
import { fetchEntitiesById } from '#/src/entities.js';
|
||||
import { fetchMovies } from '#/src/movies.js';
|
||||
import { hasOpenReport } from '#/src/reports.js';
|
||||
import { fetchScenes } from '#/src/scenes.js';
|
||||
import { curateMoviesQuery } from '#/src/web/movies.js';
|
||||
import { curateScenesQuery } from '#/src/web/scenes.js';
|
||||
@@ -50,11 +51,13 @@ export async function onBeforeRender(pageContext) {
|
||||
const [
|
||||
[entity],
|
||||
entityReleases,
|
||||
isReported,
|
||||
] = await Promise.all([
|
||||
fetchEntitiesById([Number(entityId)], { includeChildren: true }, pageContext.user, {
|
||||
restriction: pageContext.geo.restriction,
|
||||
}),
|
||||
fetchReleases(pageContext, entityId),
|
||||
hasOpenReport(Number(entityId), pageContext.user),
|
||||
]);
|
||||
|
||||
const entityIds = entity.isIndependent || !entity.parent
|
||||
@@ -92,6 +95,7 @@ export async function onBeforeRender(pageContext) {
|
||||
title: entity.name,
|
||||
pageProps: {
|
||||
entity,
|
||||
isReported,
|
||||
...entityReleases,
|
||||
},
|
||||
campaigns: {
|
||||
|
||||
Reference in New Issue
Block a user