Skip to content

Commit

Permalink
enhance(abuses): 通報一覧ページの改修
Browse files Browse the repository at this point in the history
* fix(admin/abuse-user-reports): forwarded, moderationNote が含まれていない問題

* fix(MkAbuseReport): 通報一覧で描画が崩れる問題
  • Loading branch information
taiyme committed May 23, 2024
1 parent bad02fd commit 4f1c4bb
Show file tree
Hide file tree
Showing 8 changed files with 264 additions and 101 deletions.
8 changes: 8 additions & 0 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10009,6 +10009,14 @@ export interface Locale extends ILocale {
* 数字引用しました
*/
readonly "didNumberquote": string;
/**
* {user}によって解決済み
*/
readonly "resolvedBy": ParameterizedString<"user">;
/**
* リモートサーバーに転送済み
*/
readonly "forwardedReport": string;
readonly "_about": {
/**
* taiymeについて
Expand Down
2 changes: 2 additions & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2666,6 +2666,8 @@ _tms:
numberquote: "数字引用する"
didPakuru: "パクりました"
didNumberquote: "数字引用しました"
resolvedBy: "{user}によって解決済み"
forwardedReport: "リモートサーバーに転送済み"
_about:
title: "taiymeについて"
description: "taiymeは、Misskeyから派生したオープンソースのソフトウェアです。"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,15 @@ export class AbuseUserReportEntityService {
assigneeId: report.assigneeId,
reporter: this.userEntityService.pack(report.reporter ?? report.reporterId, null, {
schema: 'UserDetailedNotMe',
iAmModerator: true,
}),
targetUser: this.userEntityService.pack(report.targetUser ?? report.targetUserId, null, {
schema: 'UserDetailedNotMe',
iAmModerator: true,
}),
assignee: report.assigneeId ? this.userEntityService.pack(report.assignee ?? report.assigneeId, null, {
schema: 'UserDetailedNotMe',
iAmModerator: true,
}) : null,
forwarded: report.forwarded,
});
Expand Down
4 changes: 3 additions & 1 deletion packages/backend/src/core/entities/UserEntityService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,19 +404,21 @@ export class UserEntityService implements OnModuleInit {
userRelations?: Map<MiUser['id'], UserRelation>,
userMemos?: Map<MiUser['id'], string | null>,
pinNotes?: Map<MiUser['id'], MiUserNotePining[]>,
iAmModerator?: boolean,
},
): Promise<Packed<S>> {
const opts = Object.assign({
schema: 'UserLite',
includeSecrets: false,
iAmModerator: false,
}, options);

const user = typeof src === 'object' ? src : await this.usersRepository.findOneByOrFail({ id: src });

const isDetailed = opts.schema !== 'UserLite';
const meId = me ? me.id : null;
const isMe = meId === user.id;
const iAmModerator = me ? await this.roleService.isModerator(me as MiUser) : false;
const iAmModerator = opts.iAmModerator || (me ? await this.roleService.isModerator(me as MiUser) : false);

const profile = isDetailed
? (opts.userProfile ?? await this.userProfilesRepository.findOneByOrFail({ userId: user.id }))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ export const meta = {
nullable: true, optional: true,
ref: 'UserDetailedNotMe',
},
forwarded: {
type: 'boolean',
nullable: false, optional: false,
},
},
},
},
Expand Down
Loading

0 comments on commit 4f1c4bb

Please sign in to comment.