enhance(backend): refine moderation log (#10939)

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* Update DriveService.ts
This commit is contained in:
syuilo 2023-09-23 18:28:16 +09:00 committed by GitHub
parent ba6e85482e
commit 9e4d3ebe5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 563 additions and 39 deletions

View file

@ -2278,7 +2278,8 @@ declare namespace entities {
Invite,
InviteLimit,
UserSorting,
OriginType
OriginType,
ModerationLog
}
}
export { entities }
@ -2516,6 +2517,50 @@ type MessagingMessage = {
groupId: UserGroup['id'] | null;
};
// @public (undocumented)
type ModerationLog = {
id: ID;
createdAt: DateString;
userId: User['id'];
user: UserDetailed | null;
} & ({
type: 'updateServerSettings';
info: ModerationLogPayloads['updateServerSettings'];
} | {
type: 'suspend';
info: ModerationLogPayloads['suspend'];
} | {
type: 'unsuspend';
info: ModerationLogPayloads['unsuspend'];
} | {
type: 'updateUserNote';
info: ModerationLogPayloads['updateUserNote'];
} | {
type: 'addCustomEmoji';
info: ModerationLogPayloads['addCustomEmoji'];
} | {
type: 'assignRole';
info: ModerationLogPayloads['assignRole'];
} | {
type: 'unassignRole';
info: ModerationLogPayloads['unassignRole'];
} | {
type: 'updateRole';
info: ModerationLogPayloads['updateRole'];
} | {
type: 'deleteRole';
info: ModerationLogPayloads['deleteRole'];
} | {
type: 'clearQueue';
info: ModerationLogPayloads['clearQueue'];
} | {
type: 'promoteQueue';
info: ModerationLogPayloads['promoteQueue'];
});
// @public (undocumented)
export const moderationLogTypes: readonly ["updateServerSettings", "suspend", "unsuspend", "updateUserNote", "addCustomEmoji", "assignRole", "unassignRole", "updateRole", "deleteRole", "clearQueue", "promoteQueue", "deleteDriveFile", "deleteNote", "createGlobalAnnouncement", "createUserAnnouncement"];
// @public (undocumented)
export const mutedNoteReasons: readonly ["word", "manual", "spam", "other"];
@ -2861,6 +2906,7 @@ type UserSorting = '+follower' | '-follower' | '+createdAt' | '-createdAt' | '+u
// src/api.types.ts:16:32 - (ae-forgotten-export) The symbol "TODO" needs to be exported by the entry point index.d.ts
// src/api.types.ts:18:25 - (ae-forgotten-export) The symbol "NoParams" needs to be exported by the entry point index.d.ts
// src/api.types.ts:631:18 - (ae-forgotten-export) The symbol "ShowUserReq" needs to be exported by the entry point index.d.ts
// src/entities.ts:579:2 - (ae-forgotten-export) The symbol "ModerationLogPayloads" needs to be exported by the entry point index.d.ts
// src/streaming.types.ts:33:4 - (ae-forgotten-export) The symbol "FIXME" needs to be exported by the entry point index.d.ts
// (No @packageDocumentation comment for this package)

View file

@ -44,3 +44,82 @@ export const permissions = [
'read:flash-likes',
'write:flash-likes',
];
export const moderationLogTypes = [
'updateServerSettings',
'suspend',
'unsuspend',
'updateUserNote',
'addCustomEmoji',
'assignRole',
'unassignRole',
'updateRole',
'deleteRole',
'clearQueue',
'promoteQueue',
'deleteDriveFile',
'deleteNote',
'createGlobalAnnouncement',
'createUserAnnouncement',
] as const;
export type ModerationLogPayloads = {
updateServerSettings: {
before: any | null;
after: any | null;
};
suspend: {
targetId: string;
};
unsuspend: {
targetId: string;
};
updateUserNote: {
userId: string;
before: string | null;
after: string | null;
};
addCustomEmoji: {
emojiId: string;
};
assignRole: {
userId: string;
roleId: string;
roleName: string;
expiresAt: string | null;
};
unassignRole: {
userId: string;
roleId: string;
roleName: string;
};
updateRole: {
roleId: string;
before: any;
after: any;
};
deleteRole: {
roleId: string;
roleName: string;
};
clearQueue: Record<string, never>;
promoteQueue: Record<string, never>;
deleteDriveFile: {
fileId: string;
fileUserId: string | null;
};
deleteNote: {
noteId: string;
noteUserId: string;
note: any;
};
createGlobalAnnouncement: {
announcementId: string;
announcement: any;
};
createUserAnnouncement: {
announcementId: string;
announcement: any;
userId: string;
};
};

View file

@ -1,3 +1,5 @@
import { ModerationLogPayloads } from './consts.js';
export type ID = string;
export type DateString = string;
@ -566,3 +568,43 @@ export type UserSorting =
| '+updatedAt'
| '-updatedAt';
export type OriginType = 'combined' | 'local' | 'remote';
export type ModerationLog = {
id: ID;
createdAt: DateString;
userId: User['id'];
user: UserDetailed | null;
} & ({
type: 'updateServerSettings';
info: ModerationLogPayloads['updateServerSettings'];
} | {
type: 'suspend';
info: ModerationLogPayloads['suspend'];
} | {
type: 'unsuspend';
info: ModerationLogPayloads['unsuspend'];
} | {
type: 'updateUserNote';
info: ModerationLogPayloads['updateUserNote'];
} | {
type: 'addCustomEmoji';
info: ModerationLogPayloads['addCustomEmoji'];
} | {
type: 'assignRole';
info: ModerationLogPayloads['assignRole'];
} | {
type: 'unassignRole';
info: ModerationLogPayloads['unassignRole'];
} | {
type: 'updateRole';
info: ModerationLogPayloads['updateRole'];
} | {
type: 'deleteRole';
info: ModerationLogPayloads['deleteRole'];
} | {
type: 'clearQueue';
info: ModerationLogPayloads['clearQueue'];
} | {
type: 'promoteQueue';
info: ModerationLogPayloads['promoteQueue'];
});

View file

@ -17,6 +17,7 @@ export const notificationTypes = consts.notificationTypes;
export const noteVisibilities = consts.noteVisibilities;
export const mutedNoteReasons = consts.mutedNoteReasons;
export const ffVisibility = consts.ffVisibility;
export const moderationLogTypes = consts.moderationLogTypes;
// api extractor not supported yet
//export * as api from './api.js';