AbuseUserReport の category を camelCase にする & notLike で通報されないようにする (MisskeyIO#298)
This commit is contained in:
parent
6de9a8ccbf
commit
2e2970eafd
|
@ -1203,13 +1203,13 @@ export interface Locale {
|
||||||
"spam": string;
|
"spam": string;
|
||||||
"explicit": string;
|
"explicit": string;
|
||||||
"phishing": string;
|
"phishing": string;
|
||||||
"personalinfoleak": string;
|
"personalInfoLeak": string;
|
||||||
"selfharm": string;
|
"selfHarm": string;
|
||||||
"criticalbreach": string;
|
"criticalBreach": string;
|
||||||
"otherbreach": string;
|
"otherBreach": string;
|
||||||
"violationrights": string;
|
"violationRights": string;
|
||||||
"violationrightsother": string;
|
"violationRightsOther": string;
|
||||||
"notlike": string;
|
"notLike": string;
|
||||||
"other": string;
|
"other": string;
|
||||||
};
|
};
|
||||||
"_announcement": {
|
"_announcement": {
|
||||||
|
|
|
@ -1201,13 +1201,13 @@ _abuseReportCategory:
|
||||||
spam: "スパム"
|
spam: "スパム"
|
||||||
explicit: "暴力もしくは攻撃的な投稿"
|
explicit: "暴力もしくは攻撃的な投稿"
|
||||||
phishing: "フィッシングもしくは詐欺行為"
|
phishing: "フィッシングもしくは詐欺行為"
|
||||||
personalinfoleak: "本人もしくは他人の個人情報の漏えい"
|
personalInfoLeak: "本人もしくは他人の個人情報の漏えい"
|
||||||
selfharm: "自殺もしくは自害など生命に関わる問題"
|
selfHarm: "自殺もしくは自害など生命に関わる問題"
|
||||||
criticalbreach: "重大な規約違反"
|
criticalBreach: "重大な規約違反"
|
||||||
otherbreach: "その他の規約違反"
|
otherBreach: "その他の規約違反"
|
||||||
violationrights: "権利侵害もしくはなりすまし(本人)"
|
violationRights: "権利侵害もしくはなりすまし(本人)"
|
||||||
violationrightsother: "権利侵害(他人)"
|
violationRightsOther: "権利侵害(他人)"
|
||||||
notlike: "この人が気に入らない"
|
notLike: "この人が気に入らない"
|
||||||
other: "その他"
|
other: "その他"
|
||||||
|
|
||||||
_announcement:
|
_announcement:
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
export class AbuseUserReportCategoryCamelCase1703749589203 {
|
||||||
|
name = 'AbuseUserReportCategoryCamelCase1703749589203'
|
||||||
|
|
||||||
|
async up(queryRunner) {
|
||||||
|
await queryRunner.query(`UPDATE "abuse_user_report" SET "category" = 'personalInfoLeak' WHERE "category" = 'personalinfoleak'`);
|
||||||
|
await queryRunner.query(`UPDATE "abuse_user_report" SET "category" = 'selfHarm' WHERE "category" = 'selfharm'`);
|
||||||
|
await queryRunner.query(`UPDATE "abuse_user_report" SET "category" = 'criticalBreach' WHERE "category" = 'criticalbreach'`);
|
||||||
|
await queryRunner.query(`UPDATE "abuse_user_report" SET "category" = 'otherBreach' WHERE "category" = 'otherbreach'`);
|
||||||
|
await queryRunner.query(`UPDATE "abuse_user_report" SET "category" = 'violationRights' WHERE "category" = 'violationrights'`);
|
||||||
|
await queryRunner.query(`UPDATE "abuse_user_report" SET "category" = 'violationRightsOther' WHERE "category" = 'violationrightsother'`);
|
||||||
|
await queryRunner.query(`UPDATE "abuse_user_report" SET "category" = 'notLike' WHERE "category" = 'notlike'`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async down(queryRunner) {
|
||||||
|
await queryRunner.query(`UPDATE "abuse_user_report" SET "category" = 'personalinfoleak' WHERE "category" = 'personalInfoLeak'`);
|
||||||
|
await queryRunner.query(`UPDATE "abuse_user_report" SET "category" = 'selfharm' WHERE "category" = 'selfHarm'`);
|
||||||
|
await queryRunner.query(`UPDATE "abuse_user_report" SET "category" = 'criticalbreach' WHERE "category" = 'criticalBreach'`);
|
||||||
|
await queryRunner.query(`UPDATE "abuse_user_report" SET "category" = 'otherbreach' WHERE "category" = 'otherBreach'`);
|
||||||
|
await queryRunner.query(`UPDATE "abuse_user_report" SET "category" = 'violationrights' WHERE "category" = 'violationRights'`);
|
||||||
|
await queryRunner.query(`UPDATE "abuse_user_report" SET "category" = 'violationrightsother' WHERE "category" = 'violationRightsOther'`);
|
||||||
|
await queryRunner.query(`UPDATE "abuse_user_report" SET "category" = 'notlike' WHERE "category" = 'notLike'`);
|
||||||
|
}
|
||||||
|
}
|
|
@ -77,7 +77,7 @@ export const meta = {
|
||||||
category: {
|
category: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
nullable: false, optional: false,
|
nullable: false, optional: false,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -48,7 +48,31 @@ export const paramDef = {
|
||||||
properties: {
|
properties: {
|
||||||
userId: { type: 'string', format: 'misskey:id' },
|
userId: { type: 'string', format: 'misskey:id' },
|
||||||
comment: { type: 'string', minLength: 1, maxLength: 2048 },
|
comment: { type: 'string', minLength: 1, maxLength: 2048 },
|
||||||
category: { type: 'string', minLength: 1, maxLength: 20, default: 'other' },
|
category: {
|
||||||
|
type: 'string',
|
||||||
|
default: 'other',
|
||||||
|
enum: [
|
||||||
|
'nsfw',
|
||||||
|
'spam',
|
||||||
|
'explicit',
|
||||||
|
'phishing',
|
||||||
|
'personalInfoLeak',
|
||||||
|
'selfHarm',
|
||||||
|
'criticalBreach',
|
||||||
|
'otherBreach',
|
||||||
|
'violationRights',
|
||||||
|
'violationRightsOther',
|
||||||
|
'other',
|
||||||
|
// for compatibility
|
||||||
|
'personalinfoleak',
|
||||||
|
'selfharm',
|
||||||
|
'criticalbreach',
|
||||||
|
'otherbreach',
|
||||||
|
'violationrights',
|
||||||
|
'violationrightsother',
|
||||||
|
'notlike',
|
||||||
|
],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
required: ['userId', 'comment'],
|
required: ['userId', 'comment'],
|
||||||
} as const;
|
} as const;
|
||||||
|
@ -79,6 +103,20 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
throw new ApiError(meta.errors.cannotReportAdmin);
|
throw new ApiError(meta.errors.cannotReportAdmin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// for compatibility
|
||||||
|
if (ps.category === 'notlike') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const categoriesMap: Record<string, typeof paramDef['properties']['category']['enum'][number]> = {
|
||||||
|
'personalinfoleak': 'personalInfoLeak',
|
||||||
|
'selfharm': 'selfHarm',
|
||||||
|
'criticalbreach': 'criticalBreach',
|
||||||
|
'otherbreach': 'otherBreach',
|
||||||
|
'violationrights': 'violationRights',
|
||||||
|
'violationrightsother': 'violationRightsOther',
|
||||||
|
};
|
||||||
|
|
||||||
const report = await this.abuseUserReportsRepository.insert({
|
const report = await this.abuseUserReportsRepository.insert({
|
||||||
id: this.idService.gen(),
|
id: this.idService.gen(),
|
||||||
targetUserId: user.id,
|
targetUserId: user.id,
|
||||||
|
@ -86,7 +124,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
reporterId: me.id,
|
reporterId: me.id,
|
||||||
reporterHost: null,
|
reporterHost: null,
|
||||||
comment: ps.comment,
|
comment: ps.comment,
|
||||||
category: ps.category,
|
category: typeof categoriesMap[ps.category] === 'string' ? categoriesMap[ps.category] : ps.category,
|
||||||
}).then(x => this.abuseUserReportsRepository.findOneByOrFail(x.identifiers[0]));
|
}).then(x => this.abuseUserReportsRepository.findOneByOrFail(x.identifiers[0]));
|
||||||
|
|
||||||
this.queueService.createReportAbuseJob(report);
|
this.queueService.createReportAbuseJob(report);
|
||||||
|
|
|
@ -23,13 +23,13 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<option value="spam">{{ i18n.ts._abuseReportCategory.spam }}</option>
|
<option value="spam">{{ i18n.ts._abuseReportCategory.spam }}</option>
|
||||||
<option value="explicit">{{ i18n.ts._abuseReportCategory.explicit }}</option>
|
<option value="explicit">{{ i18n.ts._abuseReportCategory.explicit }}</option>
|
||||||
<option value="phishing">{{ i18n.ts._abuseReportCategory.phishing }}</option>
|
<option value="phishing">{{ i18n.ts._abuseReportCategory.phishing }}</option>
|
||||||
<option value="personalinfoleak">{{ i18n.ts._abuseReportCategory.personalinfoleak }}</option>
|
<option value="personalInfoLeak">{{ i18n.ts._abuseReportCategory.personalInfoLeak }}</option>
|
||||||
<option value="selfharm">{{ i18n.ts._abuseReportCategory.selfharm }}</option>
|
<option value="selfHarm">{{ i18n.ts._abuseReportCategory.selfHarm }}</option>
|
||||||
<option value="criticalbreach">{{ i18n.ts._abuseReportCategory.criticalbreach }}</option>
|
<option value="criticalBreach">{{ i18n.ts._abuseReportCategory.criticalBreach }}</option>
|
||||||
<option value="otherbreach">{{ i18n.ts._abuseReportCategory.otherbreach }}</option>
|
<option value="otherBreach">{{ i18n.ts._abuseReportCategory.otherBreach }}</option>
|
||||||
<option value="violationrights">{{ i18n.ts._abuseReportCategory.violationrights }}</option>
|
<option value="violationRights">{{ i18n.ts._abuseReportCategory.violationRights }}</option>
|
||||||
<option value="violationrightsother">{{ i18n.ts._abuseReportCategory.violationrightsother }}</option>
|
<option value="violationRightsOther">{{ i18n.ts._abuseReportCategory.violationRightsOther }}</option>
|
||||||
<option value="notlike">{{ i18n.ts._abuseReportCategory.notlike }}</option>
|
<option value="notLike">{{ i18n.ts._abuseReportCategory.notLike }}</option>
|
||||||
<option value="other">{{ i18n.ts._abuseReportCategory.other }}</option>
|
<option value="other">{{ i18n.ts._abuseReportCategory.other }}</option>
|
||||||
</MkSelect>
|
</MkSelect>
|
||||||
</div>
|
</div>
|
||||||
|
@ -107,24 +107,25 @@ function muteUser() {
|
||||||
|
|
||||||
function refreshUserInfo() {
|
function refreshUserInfo() {
|
||||||
os.api('users/show', { userId: props.user.id })
|
os.api('users/show', { userId: props.user.id })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
fullUserInfo.value = res;
|
fullUserInfo.value = res;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function send() {
|
function send() {
|
||||||
if (category.value === 'violationrightsother') {
|
if (category.value === 'violationRightsOther') {
|
||||||
os.alert({
|
os.alert({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
text: i18n.ts._abuseReportMsgs.rightsAbuseCantAccept
|
text: i18n.ts._abuseReportMsgs.rightsAbuseCantAccept,
|
||||||
});
|
});
|
||||||
uiWindow.value?.close();
|
uiWindow.value?.close();
|
||||||
emit('closed');
|
emit('closed');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (category.value === 'notlike') {
|
if (category.value === 'notLike') {
|
||||||
uiWindow.value?.close();
|
uiWindow.value?.close();
|
||||||
page.value = 2;
|
page.value = 2;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
os.apiWithDialog('users/report-abuse', {
|
os.apiWithDialog('users/report-abuse', {
|
||||||
userId: props.user.id,
|
userId: props.user.id,
|
||||||
|
@ -132,11 +133,11 @@ function send() {
|
||||||
category: category.value,
|
category: category.value,
|
||||||
}, undefined).then(res => {
|
}, undefined).then(res => {
|
||||||
os.api('users/show', { userId: props.user.id })
|
os.api('users/show', { userId: props.user.id })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
fullUserInfo.value = res;
|
fullUserInfo.value = res;
|
||||||
uiWindow.value?.close();
|
uiWindow.value?.close();
|
||||||
page.value = 2;
|
page.value = 2;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* version: 2023.12.1-io
|
* version: 2023.12.2-io
|
||||||
* generatedAt: 2023-12-27T19:40:57.229Z
|
* generatedAt: 2023-12-28T08:11:13.114Z
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { SwitchCaseResponseType } from '../api.js';
|
import type { SwitchCaseResponseType } from '../api.js';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* version: 2023.12.1-io
|
* version: 2023.12.2-io
|
||||||
* generatedAt: 2023-12-27T19:40:57.223Z
|
* generatedAt: 2023-12-28T08:11:13.103Z
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* version: 2023.12.1-io
|
* version: 2023.12.2-io
|
||||||
* generatedAt: 2023-12-27T19:40:57.217Z
|
* generatedAt: 2023-12-28T08:11:13.098Z
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { operations } from './types.js';
|
import { operations } from './types.js';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* version: 2023.12.1-io
|
* version: 2023.12.2-io
|
||||||
* generatedAt: 2023-12-27T19:40:57.214Z
|
* generatedAt: 2023-12-28T08:11:13.095Z
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { components } from './types.js';
|
import { components } from './types.js';
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
/* eslint @typescript-eslint/no-explicit-any: 0 */
|
/* eslint @typescript-eslint/no-explicit-any: 0 */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* version: 2023.12.1-io
|
* version: 2023.12.2-io
|
||||||
* generatedAt: 2023-12-27T19:40:56.996Z
|
* generatedAt: 2023-12-28T08:11:12.906Z
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4478,6 +4478,7 @@ export type components = {
|
||||||
* @example xxxxxxxxxx
|
* @example xxxxxxxxxx
|
||||||
*/
|
*/
|
||||||
id: string;
|
id: string;
|
||||||
|
category: string;
|
||||||
/** Format: date-time */
|
/** Format: date-time */
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
comment: string;
|
comment: string;
|
||||||
|
@ -4696,6 +4697,8 @@ export type operations = {
|
||||||
targetUserOrigin?: 'combined' | 'local' | 'remote';
|
targetUserOrigin?: 'combined' | 'local' | 'remote';
|
||||||
/** @default false */
|
/** @default false */
|
||||||
forwarded?: boolean;
|
forwarded?: boolean;
|
||||||
|
/** @default null */
|
||||||
|
category?: string | null;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -4723,6 +4726,7 @@ export type operations = {
|
||||||
reporter: components['schemas']['User'];
|
reporter: components['schemas']['User'];
|
||||||
targetUser: components['schemas']['User'];
|
targetUser: components['schemas']['User'];
|
||||||
assignee?: components['schemas']['User'] | null;
|
assignee?: components['schemas']['User'] | null;
|
||||||
|
category: string;
|
||||||
})[];
|
})[];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -25233,6 +25237,11 @@ export type operations = {
|
||||||
/** Format: misskey:id */
|
/** Format: misskey:id */
|
||||||
userId: string;
|
userId: string;
|
||||||
comment: string;
|
comment: string;
|
||||||
|
/**
|
||||||
|
* @default other
|
||||||
|
* @enum {string}
|
||||||
|
*/
|
||||||
|
category?: 'nsfw' | 'spam' | 'explicit' | 'phishing' | 'personalInfoLeak' | 'selfHarm' | 'criticalBreach' | 'otherBreach' | 'violationRights' | 'violationRightsOther' | 'other' | 'personalinfoleak' | 'selfharm' | 'criticalbreach' | 'otherbreach' | 'violationrights' | 'violationrightsother' | 'notlike';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue