mirror of
https://github.com/aljazceru/ditto.git
synced 2026-01-09 08:34:20 +01:00
feat: implement report resolve
This commit is contained in:
@@ -30,13 +30,14 @@ async function renderReport(reportEvent: DittoEvent, profile: DittoEvent) {
|
||||
|
||||
interface RenderAdminReportOpts {
|
||||
viewerPubkey?: string;
|
||||
action_taken?: boolean;
|
||||
}
|
||||
|
||||
/** Admin-level information about a filed report.
|
||||
* Expects an event of kind 1984 fully hydrated.
|
||||
* https://docs.joinmastodon.org/entities/Admin_Report */
|
||||
async function renderAdminReport(reportEvent: DittoEvent, opts: RenderAdminReportOpts) {
|
||||
const { viewerPubkey } = opts;
|
||||
const { viewerPubkey, action_taken = false } = opts;
|
||||
|
||||
// The category is present in both the 'e' and 'p' tag, however, it is possible to report a user without reporting a note, so it's better to get the category from the 'p' tag
|
||||
const category = reportEvent.tags.find(([name]) => name === 'p')?.[2];
|
||||
@@ -50,7 +51,7 @@ async function renderAdminReport(reportEvent: DittoEvent, opts: RenderAdminRepor
|
||||
|
||||
return {
|
||||
id: reportEvent.id,
|
||||
action_taken: false,
|
||||
action_taken,
|
||||
action_taken_at: null,
|
||||
category,
|
||||
comment: reportEvent.content,
|
||||
|
||||
Reference in New Issue
Block a user