Feat: GDPRモードを追加した
Signed-off-by: mattyatea <mattyacocacora0@gmail.com>
This commit is contained in:
parent
cb1586658e
commit
74e45b13eb
13 changed files with 83 additions and 8 deletions
|
|
@ -416,6 +416,10 @@ export const meta = {
|
|||
type: 'string',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
enableGDPRMode: {
|
||||
type: 'boolean',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
|
@ -534,6 +538,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
perUserHomeTimelineCacheMax: instance.perUserHomeTimelineCacheMax,
|
||||
perUserListTimelineCacheMax: instance.perUserListTimelineCacheMax,
|
||||
notesPerOneAd: instance.notesPerOneAd,
|
||||
enableGDPRMode: instance.enableGDPRMode,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -138,6 +138,7 @@ export const paramDef = {
|
|||
type: 'string',
|
||||
},
|
||||
},
|
||||
enableGDPRMode: { type: 'boolean' },
|
||||
},
|
||||
required: [],
|
||||
} as const;
|
||||
|
|
@ -209,6 +210,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
if (ps.infoImageUrl !== undefined) {
|
||||
set.infoImageUrl = ps.infoImageUrl;
|
||||
}
|
||||
console.log(ps.enableGDPRMode);
|
||||
if (ps.enableGDPRMode !== undefined) {
|
||||
set.enableGDPRMode = ps.enableGDPRMode;
|
||||
}
|
||||
|
||||
if (ps.notFoundImageUrl !== undefined) {
|
||||
set.notFoundImageUrl = ps.notFoundImageUrl;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ export const meta = {
|
|||
requireCredential: true,
|
||||
kind: 'write:report-abuse',
|
||||
|
||||
description: 'User a report.',
|
||||
description: 'File a report.',
|
||||
|
||||
errors: {
|
||||
noSuchUser: {
|
||||
|
|
@ -91,9 +91,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
}
|
||||
|
||||
const notes = ps.noteIds ? await this.notesRepository.find({
|
||||
where: { id: In(ps.noteIds) },
|
||||
where: { id: In(ps.noteIds), userId: user.id },
|
||||
}) : [];
|
||||
const filteredNotes = notes.filter(note => note.userId === user.id);
|
||||
|
||||
const report = await this.abuseUserReportsRepository.insert({
|
||||
id: this.idService.gen(),
|
||||
targetUserId: user.id,
|
||||
|
|
@ -101,7 +101,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
reporterId: me.id,
|
||||
reporterHost: null,
|
||||
comment: ps.comment,
|
||||
notes: ps.noteIds ? await this.noteEntityService.packMany(filteredNotes) : [],
|
||||
notes: (ps.noteIds && !((await this.metaService.fetch()).enableGDPRMode)) ? await this.noteEntityService.packMany(notes) : [],
|
||||
noteIds: (ps.noteIds && (await this.metaService.fetch()).enableGDPRMode) ? ps.noteIds : [],
|
||||
}).then(x => this.abuseUserReportsRepository.findOneByOrFail(x.identifiers[0]));
|
||||
|
||||
// Publish event to moderators
|
||||
|
|
@ -115,6 +116,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
reporterId: report.reporterId,
|
||||
comment: report.comment,
|
||||
notes: report.notes,
|
||||
noteIds: report.noteIds ?? [],
|
||||
});
|
||||
}
|
||||
const meta = await this.metaService.fetch();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue