1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-25 17:26:43 +00:00

Update AdminReports, add story reports and fix cs

This commit is contained in:
Daniel Supernault 2024-02-26 21:33:10 -07:00
parent 071163b47b
commit 767522a85c
No known key found for this signature in database
GPG key ID: 23740873EE6F76A1

View file

@ -427,6 +427,31 @@
</div> </div>
</div> </div>
<div v-else-if="viewingReport && viewingReport.object_type === 'App\\Story' && viewingReport.story" class="list-group mt-3">
<div v-if="viewingReport && viewingReport.story" class="list-group-item d-flex flex-column flex-grow-1" style="gap:0.4rem;">
<div class="d-flex justify-content-between mt-n1 text-muted small font-weight-bold">
<div>Reported Story</div>
<a class="font-weight-bold" :href="viewingReport.story.url" target="_blank">View</a>
</div>
<img
v-if="viewingReport.story.type === 'photo'"
:src="viewingReport.story.media_src"
height="140"
class="rounded"
style="object-fit: cover;"
onerror="this.src='/storage/no-preview.png';this.error=null;" />
<video
v-else-if="viewingReport.story.type === 'video'"
height="140"
controls
:src="viewingReport.story.media_src"
onerror="this.src='/storage/no-preview.png';this.onerror=null;"
></video>
</div>
</div>
<div v-if="viewingReport && viewingReport.admin_seen_at === null" class="mt-4"> <div v-if="viewingReport && viewingReport.admin_seen_at === null" class="mt-4">
<div v-if="viewingReport && viewingReport.object_type === 'App\\Profile'"> <div v-if="viewingReport && viewingReport.object_type === 'App\\Profile'">
<button class="btn btn-dark btn-block rounded-pill" @click="handleAction('profile', 'ignore')">Ignore Report</button> <button class="btn btn-dark btn-block rounded-pill" @click="handleAction('profile', 'ignore')">Ignore Report</button>
@ -454,7 +479,7 @@
</button> </button>
</div> </div>
<div v-if="viewingReport && viewingReport.object_type === 'App\\Status'"> <div v-else-if="viewingReport && viewingReport.object_type === 'App\\Status'">
<button class="btn btn-dark btn-block rounded-pill" @click="handleAction('post', 'ignore')">Ignore Report</button> <button class="btn btn-dark btn-block rounded-pill" @click="handleAction('post', 'ignore')">Ignore Report</button>
<hr v-if="viewingReport && viewingReport.reported && !viewingReport.reported.is_admin" class="mt-3 mb-1"> <hr v-if="viewingReport && viewingReport.reported && !viewingReport.reported.is_admin" class="mt-3 mb-1">
<div <div
@ -481,6 +506,24 @@
</div> </div>
</div> </div>
</div> </div>
<div v-else-if="viewingReport && viewingReport.object_type === 'App\\Story'">
<button class="btn btn-dark btn-block rounded-pill" @click="handleAction('story', 'ignore')">Ignore Report</button>
<hr v-if="viewingReport && viewingReport.reported && !viewingReport.reported.is_admin" class="mt-3 mb-1">
<div v-if="viewingReport && viewingReport.reported && !viewingReport.reported.is_admin">
<div class="d-flex flex-row mt-2" style="gap:0.3rem;">
<button class="btn btn-danger btn-block rounded-pill mt-0" @click="handleAction('story', 'delete')">Delete Story</button>
<button class="btn btn-outline-danger btn-block rounded-pill mt-0" @click="handleAction('story', 'delete-all')">Delete All Stories</button>
</div>
</div>
<div v-if="viewingReport && viewingReport.reported && !viewingReport.reported.is_admin">
<hr class="my-2">
<div class="d-flex flex-row mt-2" style="gap:0.3rem;">
<button class="btn btn-outline-danger btn-sm btn-block rounded-pill mt-0" @click="handleAction('profile', 'delete')">Delete Account</button>
</div>
</div>
</div>
</div> </div>
</template> </template>
</b-modal> </b-modal>
@ -707,6 +750,9 @@
case 'App\\Status': case 'App\\Status':
return `${report.type} Post`; return `${report.type} Post`;
break; break;
case 'App\\Story':
return `${report.type} Story`;
break;
} }
}, },
@ -766,6 +812,7 @@
} }
this.loaded = false; this.loaded = false;
axios.post('/i/admin/api/reports/handle', { axios.post('/i/admin/api/reports/handle', {
id: this.viewingReport.id, id: this.viewingReport.id,
object_id: this.viewingReport.object_id, object_id: this.viewingReport.object_id,
@ -831,6 +878,20 @@
return 'Are you sure you want to delete this post?'; return 'Are you sure you want to delete this post?';
break; break;
} }
} else if(type === 'story') {
switch(action) {
case 'ignore':
return 'Are you sure you want to ignore this story report?';
break;
case 'delete':
return 'Are you sure you want to delete this story?';
break;
case 'delete-all':
return 'Are you sure you want to delete all stories by this account?';
break;
}
} }
}, },