enhance(backend): ページ、ギャラリー、Playのモデレーション強化 (#13523)
* enhance(backend): Page、ギャラリー、Playのモデレーション強化 * Update CHANGELOG.md * fix: update misskey-js * refactor(frontend): use `MkA` * Update CHANGELOG.md * fix(i18n): Page -> ページ
This commit is contained in:
parent
383c41bdb6
commit
fd744f44c1
|
@ -3,10 +3,12 @@
|
||||||
### General
|
### General
|
||||||
- Enhance: モデレーターはすべてのユーザーのフォロー・フォロワーの一覧を見られるように
|
- Enhance: モデレーターはすべてのユーザーのフォロー・フォロワーの一覧を見られるように
|
||||||
- Enhance: アカウントの削除のモデレーションログを残すように
|
- Enhance: アカウントの削除のモデレーションログを残すように
|
||||||
|
- Enhance: 不適切なページ、ギャラリー、Playを管理者権限で削除できるように
|
||||||
- Fix: リモートユーザのフォロー・フォロワーの一覧が非公開設定の場合も表示できてしまう問題を修正
|
- Fix: リモートユーザのフォロー・フォロワーの一覧が非公開設定の場合も表示できてしまう問題を修正
|
||||||
|
|
||||||
### Client
|
### Client
|
||||||
- Enhance: 「自分のPlay」ページにおいてPlayが非公開かどうかが一目でわかるように
|
- Enhance: 「自分のPlay」ページにおいてPlayが非公開かどうかが一目でわかるように
|
||||||
|
- Enhance: 不適切なページ、ギャラリー、Playを通報できるように
|
||||||
- Fix: Play編集時に公開範囲が「パブリック」にリセットされる問題を修正
|
- Fix: Play編集時に公開範囲が「パブリック」にリセットされる問題を修正
|
||||||
- Fix: ページ遷移に失敗することがある問題を修正
|
- Fix: ページ遷移に失敗することがある問題を修正
|
||||||
- Fix: iOSでユーザー名などがリンクとして誤検知される現象を抑制
|
- Fix: iOSでユーザー名などがリンクとして誤検知される現象を抑制
|
||||||
|
|
|
@ -2829,7 +2829,7 @@ export interface Locale extends ILocale {
|
||||||
*/
|
*/
|
||||||
"reportAbuseOf": ParameterizedString<"name">;
|
"reportAbuseOf": ParameterizedString<"name">;
|
||||||
/**
|
/**
|
||||||
* 通報理由の詳細を記入してください。対象のノートがある場合はそのURLも記入してください。
|
* 通報理由の詳細を記入してください。対象のノートやページなどがある場合はそのURLも記入してください。
|
||||||
*/
|
*/
|
||||||
"fillAbuseReportDescription": string;
|
"fillAbuseReportDescription": string;
|
||||||
/**
|
/**
|
||||||
|
@ -9687,6 +9687,18 @@ export interface Locale extends ILocale {
|
||||||
* アカウントを削除
|
* アカウントを削除
|
||||||
*/
|
*/
|
||||||
"deleteAccount": string;
|
"deleteAccount": string;
|
||||||
|
/**
|
||||||
|
* ページを削除
|
||||||
|
*/
|
||||||
|
"deletePage": string;
|
||||||
|
/**
|
||||||
|
* Playを削除
|
||||||
|
*/
|
||||||
|
"deleteFlash": string;
|
||||||
|
/**
|
||||||
|
* ギャラリーの投稿を削除
|
||||||
|
*/
|
||||||
|
"deleteGalleryPost": string;
|
||||||
};
|
};
|
||||||
"_fileViewer": {
|
"_fileViewer": {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -703,7 +703,7 @@ abuseReports: "通報"
|
||||||
reportAbuse: "通報"
|
reportAbuse: "通報"
|
||||||
reportAbuseRenote: "リノートを通報"
|
reportAbuseRenote: "リノートを通報"
|
||||||
reportAbuseOf: "{name}を通報する"
|
reportAbuseOf: "{name}を通報する"
|
||||||
fillAbuseReportDescription: "通報理由の詳細を記入してください。対象のノートがある場合はそのURLも記入してください。"
|
fillAbuseReportDescription: "通報理由の詳細を記入してください。対象のノートやページなどがある場合はそのURLも記入してください。"
|
||||||
abuseReported: "内容が送信されました。ご報告ありがとうございました。"
|
abuseReported: "内容が送信されました。ご報告ありがとうございました。"
|
||||||
reporter: "通報者"
|
reporter: "通報者"
|
||||||
reporteeOrigin: "通報先"
|
reporteeOrigin: "通報先"
|
||||||
|
@ -2569,6 +2569,9 @@ _moderationLogTypes:
|
||||||
updateAbuseReportNotificationRecipient: "通報の通知先を更新"
|
updateAbuseReportNotificationRecipient: "通報の通知先を更新"
|
||||||
deleteAbuseReportNotificationRecipient: "通報の通知先を削除"
|
deleteAbuseReportNotificationRecipient: "通報の通知先を削除"
|
||||||
deleteAccount: "アカウントを削除"
|
deleteAccount: "アカウントを削除"
|
||||||
|
deletePage: "ページを削除"
|
||||||
|
deleteFlash: "Playを削除"
|
||||||
|
deleteGalleryPost: "ギャラリーの投稿を削除"
|
||||||
|
|
||||||
_fileViewer:
|
_fileViewer:
|
||||||
title: "ファイルの詳細"
|
title: "ファイルの詳細"
|
||||||
|
|
|
@ -4,9 +4,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import type { FlashsRepository } from '@/models/_.js';
|
import type { FlashsRepository, UsersRepository } from '@/models/_.js';
|
||||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
|
import { ModerationLogService } from '@/core/ModerationLogService.js';
|
||||||
|
import { RoleService } from '@/core/RoleService.js';
|
||||||
import { ApiError } from '../../error.js';
|
import { ApiError } from '../../error.js';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
|
@ -44,17 +46,35 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(DI.flashsRepository)
|
@Inject(DI.flashsRepository)
|
||||||
private flashsRepository: FlashsRepository,
|
private flashsRepository: FlashsRepository,
|
||||||
|
|
||||||
|
@Inject(DI.usersRepository)
|
||||||
|
private usersRepository: UsersRepository,
|
||||||
|
|
||||||
|
private moderationLogService: ModerationLogService,
|
||||||
|
private roleService: RoleService,
|
||||||
) {
|
) {
|
||||||
super(meta, paramDef, async (ps, me) => {
|
super(meta, paramDef, async (ps, me) => {
|
||||||
const flash = await this.flashsRepository.findOneBy({ id: ps.flashId });
|
const flash = await this.flashsRepository.findOneBy({ id: ps.flashId });
|
||||||
|
|
||||||
if (flash == null) {
|
if (flash == null) {
|
||||||
throw new ApiError(meta.errors.noSuchFlash);
|
throw new ApiError(meta.errors.noSuchFlash);
|
||||||
}
|
}
|
||||||
if (flash.userId !== me.id) {
|
|
||||||
|
if (!await this.roleService.isModerator(me) && flash.userId !== me.id) {
|
||||||
throw new ApiError(meta.errors.accessDenied);
|
throw new ApiError(meta.errors.accessDenied);
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.flashsRepository.delete(flash.id);
|
await this.flashsRepository.delete(flash.id);
|
||||||
|
|
||||||
|
if (flash.userId !== me.id) {
|
||||||
|
const user = await this.usersRepository.findOneByOrFail({ id: flash.userId });
|
||||||
|
this.moderationLogService.log(me, 'deleteFlash', {
|
||||||
|
flashId: flash.id,
|
||||||
|
flashUserId: flash.userId,
|
||||||
|
flashUserUsername: user.username,
|
||||||
|
flash,
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,10 @@
|
||||||
|
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||||
import type { GalleryPostsRepository } from '@/models/_.js';
|
import type { GalleryPostsRepository, UsersRepository } from '@/models/_.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
|
import { ModerationLogService } from '@/core/ModerationLogService.js';
|
||||||
|
import { RoleService } from '@/core/RoleService.js';
|
||||||
import { ApiError } from '../../../error.js';
|
import { ApiError } from '../../../error.js';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
|
@ -22,6 +24,12 @@ export const meta = {
|
||||||
code: 'NO_SUCH_POST',
|
code: 'NO_SUCH_POST',
|
||||||
id: 'ae52f367-4bd7-4ecd-afc6-5672fff427f5',
|
id: 'ae52f367-4bd7-4ecd-afc6-5672fff427f5',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
accessDenied: {
|
||||||
|
message: 'Access denied.',
|
||||||
|
code: 'ACCESS_DENIED',
|
||||||
|
id: 'c86e09de-1c48-43ac-a435-1c7e42ed4496',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
@ -38,18 +46,35 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(DI.galleryPostsRepository)
|
@Inject(DI.galleryPostsRepository)
|
||||||
private galleryPostsRepository: GalleryPostsRepository,
|
private galleryPostsRepository: GalleryPostsRepository,
|
||||||
|
|
||||||
|
@Inject(DI.usersRepository)
|
||||||
|
private usersRepository: UsersRepository,
|
||||||
|
|
||||||
|
private moderationLogService: ModerationLogService,
|
||||||
|
private roleService: RoleService,
|
||||||
) {
|
) {
|
||||||
super(meta, paramDef, async (ps, me) => {
|
super(meta, paramDef, async (ps, me) => {
|
||||||
const post = await this.galleryPostsRepository.findOneBy({
|
const post = await this.galleryPostsRepository.findOneBy({ id: ps.postId });
|
||||||
id: ps.postId,
|
|
||||||
userId: me.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (post == null) {
|
if (post == null) {
|
||||||
throw new ApiError(meta.errors.noSuchPost);
|
throw new ApiError(meta.errors.noSuchPost);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!await this.roleService.isModerator(me) && post.userId !== me.id) {
|
||||||
|
throw new ApiError(meta.errors.accessDenied);
|
||||||
|
}
|
||||||
|
|
||||||
await this.galleryPostsRepository.delete(post.id);
|
await this.galleryPostsRepository.delete(post.id);
|
||||||
|
|
||||||
|
if (post.userId !== me.id) {
|
||||||
|
const user = await this.usersRepository.findOneByOrFail({ id: post.userId });
|
||||||
|
this.moderationLogService.log(me, 'deleteGalleryPost', {
|
||||||
|
postId: post.id,
|
||||||
|
postUserId: post.userId,
|
||||||
|
postUserUsername: user.username,
|
||||||
|
post,
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import type { PagesRepository } from '@/models/_.js';
|
import type { PagesRepository, UsersRepository } from '@/models/_.js';
|
||||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
|
import { ModerationLogService } from '@/core/ModerationLogService.js';
|
||||||
|
import { RoleService } from '@/core/RoleService.js';
|
||||||
import { ApiError } from '../../error.js';
|
import { ApiError } from '../../error.js';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
|
@ -44,17 +46,35 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(DI.pagesRepository)
|
@Inject(DI.pagesRepository)
|
||||||
private pagesRepository: PagesRepository,
|
private pagesRepository: PagesRepository,
|
||||||
|
|
||||||
|
@Inject(DI.usersRepository)
|
||||||
|
private usersRepository: UsersRepository,
|
||||||
|
|
||||||
|
private moderationLogService: ModerationLogService,
|
||||||
|
private roleService: RoleService,
|
||||||
) {
|
) {
|
||||||
super(meta, paramDef, async (ps, me) => {
|
super(meta, paramDef, async (ps, me) => {
|
||||||
const page = await this.pagesRepository.findOneBy({ id: ps.pageId });
|
const page = await this.pagesRepository.findOneBy({ id: ps.pageId });
|
||||||
|
|
||||||
if (page == null) {
|
if (page == null) {
|
||||||
throw new ApiError(meta.errors.noSuchPage);
|
throw new ApiError(meta.errors.noSuchPage);
|
||||||
}
|
}
|
||||||
if (page.userId !== me.id) {
|
|
||||||
|
if (!await this.roleService.isModerator(me) && page.userId !== me.id) {
|
||||||
throw new ApiError(meta.errors.accessDenied);
|
throw new ApiError(meta.errors.accessDenied);
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.pagesRepository.delete(page.id);
|
await this.pagesRepository.delete(page.id);
|
||||||
|
|
||||||
|
if (page.userId !== me.id) {
|
||||||
|
const user = await this.usersRepository.findOneByOrFail({ id: page.userId });
|
||||||
|
this.moderationLogService.log(me, 'deletePage', {
|
||||||
|
pageId: page.id,
|
||||||
|
pageUserId: page.userId,
|
||||||
|
pageUserUsername: user.username,
|
||||||
|
page,
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,6 +97,9 @@ export const moderationLogTypes = [
|
||||||
'updateAbuseReportNotificationRecipient',
|
'updateAbuseReportNotificationRecipient',
|
||||||
'deleteAbuseReportNotificationRecipient',
|
'deleteAbuseReportNotificationRecipient',
|
||||||
'deleteAccount',
|
'deleteAccount',
|
||||||
|
'deletePage',
|
||||||
|
'deleteFlash',
|
||||||
|
'deleteGalleryPost',
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export type ModerationLogPayloads = {
|
export type ModerationLogPayloads = {
|
||||||
|
@ -320,6 +323,24 @@ export type ModerationLogPayloads = {
|
||||||
userUsername: string;
|
userUsername: string;
|
||||||
userHost: string | null;
|
userHost: string | null;
|
||||||
};
|
};
|
||||||
|
deletePage: {
|
||||||
|
pageId: string;
|
||||||
|
pageUserId: string;
|
||||||
|
pageUserUsername: string;
|
||||||
|
page: any;
|
||||||
|
};
|
||||||
|
deleteFlash: {
|
||||||
|
flashId: string;
|
||||||
|
flashUserId: string;
|
||||||
|
flashUserUsername: string;
|
||||||
|
flash: any;
|
||||||
|
};
|
||||||
|
deleteGalleryPost: {
|
||||||
|
postId: string;
|
||||||
|
postUserId: string;
|
||||||
|
postUserUsername: string;
|
||||||
|
post: any;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export type Serialized<T> = {
|
export type Serialized<T> = {
|
||||||
|
|
|
@ -39,7 +39,7 @@ import * as os from '@/os.js';
|
||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
user: Misskey.entities.UserDetailed;
|
user: Misskey.entities.UserLite;
|
||||||
initialComment?: string;
|
initialComment?: string;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ import { host as hostRaw } from '@/config.js';
|
||||||
import { defaultStore } from '@/store.js';
|
import { defaultStore } from '@/store.js';
|
||||||
|
|
||||||
defineProps<{
|
defineProps<{
|
||||||
user: Misskey.entities.User;
|
user: Misskey.entities.UserLite;
|
||||||
detail?: boolean;
|
detail?: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
'deleteSystemWebhook',
|
'deleteSystemWebhook',
|
||||||
'deleteAbuseReportNotificationRecipient',
|
'deleteAbuseReportNotificationRecipient',
|
||||||
'deleteAccount',
|
'deleteAccount',
|
||||||
|
'deletePage',
|
||||||
|
'deleteFlash',
|
||||||
|
'deleteGalleryPost',
|
||||||
].includes(log.type)
|
].includes(log.type)
|
||||||
}"
|
}"
|
||||||
>{{ i18n.ts._moderationLogTypes[log.type] }}</b>
|
>{{ i18n.ts._moderationLogTypes[log.type] }}</b>
|
||||||
|
@ -74,6 +77,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<span v-else-if="log.type === 'updateAbuseReportNotificationRecipient'">: {{ log.info.before.name }}</span>
|
<span v-else-if="log.type === 'updateAbuseReportNotificationRecipient'">: {{ log.info.before.name }}</span>
|
||||||
<span v-else-if="log.type === 'deleteAbuseReportNotificationRecipient'">: {{ log.info.recipient.name }}</span>
|
<span v-else-if="log.type === 'deleteAbuseReportNotificationRecipient'">: {{ log.info.recipient.name }}</span>
|
||||||
<span v-else-if="log.type === 'deleteAccount'">: @{{ log.info.userUsername }}{{ log.info.userHost ? '@' + log.info.userHost : '' }}</span>
|
<span v-else-if="log.type === 'deleteAccount'">: @{{ log.info.userUsername }}{{ log.info.userHost ? '@' + log.info.userHost : '' }}</span>
|
||||||
|
<span v-else-if="log.type === 'deletePage'">: @{{ log.info.pageUserUsername }}</span>
|
||||||
|
<span v-else-if="log.type === 'deleteFlash'">: @{{ log.info.flashUserUsername }}</span>
|
||||||
|
<span v-else-if="log.type === 'deleteGalleryPost'">: @{{ log.info.postUserUsername }}</span>
|
||||||
</template>
|
</template>
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<MkAvatar :user="log.user" :class="$style.avatar"/>
|
<MkAvatar :user="log.user" :class="$style.avatar"/>
|
||||||
|
|
|
@ -23,6 +23,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<MkButton v-else v-tooltip="i18n.ts.like" asLike class="button" rounded @click="like()"><i class="ti ti-heart"></i><span v-if="flash?.likedCount && flash.likedCount > 0" style="margin-left: 6px;">{{ flash.likedCount }}</span></MkButton>
|
<MkButton v-else v-tooltip="i18n.ts.like" asLike class="button" rounded @click="like()"><i class="ti ti-heart"></i><span v-if="flash?.likedCount && flash.likedCount > 0" style="margin-left: 6px;">{{ flash.likedCount }}</span></MkButton>
|
||||||
<MkButton v-tooltip="i18n.ts.copyLink" class="button" rounded @click="copyLink"><i class="ti ti-link ti-fw"></i></MkButton>
|
<MkButton v-tooltip="i18n.ts.copyLink" class="button" rounded @click="copyLink"><i class="ti ti-link ti-fw"></i></MkButton>
|
||||||
<MkButton v-tooltip="i18n.ts.share" class="button" rounded @click="share"><i class="ti ti-share ti-fw"></i></MkButton>
|
<MkButton v-tooltip="i18n.ts.share" class="button" rounded @click="share"><i class="ti ti-share ti-fw"></i></MkButton>
|
||||||
|
<MkButton v-if="$i && $i.id !== flash.user.id" class="button" rounded @mousedown="showMenu"><i class="ti ti-dots ti-fw"></i></MkButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -61,7 +62,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, onDeactivated, onUnmounted, Ref, ref, watch, shallowRef } from 'vue';
|
import { computed, onDeactivated, onUnmounted, Ref, ref, watch, shallowRef, defineAsyncComponent } from 'vue';
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
import { Interpreter, Parser, values } from '@syuilo/aiscript';
|
import { Interpreter, Parser, values } from '@syuilo/aiscript';
|
||||||
import MkButton from '@/components/MkButton.vue';
|
import MkButton from '@/components/MkButton.vue';
|
||||||
|
@ -79,6 +80,7 @@ import { defaultStore } from '@/store.js';
|
||||||
import { $i } from '@/account.js';
|
import { $i } from '@/account.js';
|
||||||
import { isSupportShare } from '@/scripts/navigator.js';
|
import { isSupportShare } from '@/scripts/navigator.js';
|
||||||
import { copyToClipboard } from '@/scripts/copy-to-clipboard.js';
|
import { copyToClipboard } from '@/scripts/copy-to-clipboard.js';
|
||||||
|
import { MenuItem } from '@/types/menu';
|
||||||
import { pleaseLogin } from '@/scripts/please-login.js';
|
import { pleaseLogin } from '@/scripts/please-login.js';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
|
@ -229,6 +231,51 @@ async function run() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function reportAbuse() {
|
||||||
|
if (!flash.value) return;
|
||||||
|
|
||||||
|
const pageUrl = `${url}/play/${flash.value.id}`;
|
||||||
|
|
||||||
|
os.popup(defineAsyncComponent(() => import('@/components/MkAbuseReportWindow.vue')), {
|
||||||
|
user: flash.value.user,
|
||||||
|
initialComment: `Play: ${pageUrl}\n-----\n`,
|
||||||
|
}, {}, 'closed');
|
||||||
|
}
|
||||||
|
|
||||||
|
function showMenu(ev: MouseEvent) {
|
||||||
|
if (!flash.value) return;
|
||||||
|
|
||||||
|
const menu: MenuItem[] = [
|
||||||
|
...($i && $i.id !== flash.value.userId ? [
|
||||||
|
{
|
||||||
|
icon: 'ti ti-exclamation-circle',
|
||||||
|
text: i18n.ts.reportAbuse,
|
||||||
|
action: reportAbuse,
|
||||||
|
},
|
||||||
|
...($i.isModerator || $i.isAdmin ? [
|
||||||
|
{
|
||||||
|
type: 'divider' as const,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: 'ti ti-trash',
|
||||||
|
text: i18n.ts.delete,
|
||||||
|
danger: true,
|
||||||
|
action: () => os.confirm({
|
||||||
|
type: 'warning',
|
||||||
|
text: i18n.ts.deleteConfirm,
|
||||||
|
}).then(({ canceled }) => {
|
||||||
|
if (canceled || !flash.value) return;
|
||||||
|
|
||||||
|
os.apiWithDialog('flash/delete', { flashId: flash.value.id });
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
] : []),
|
||||||
|
] : []),
|
||||||
|
];
|
||||||
|
|
||||||
|
os.popupMenu(menu, ev.currentTarget ?? ev.target);
|
||||||
|
}
|
||||||
|
|
||||||
function reset() {
|
function reset() {
|
||||||
if (aiscript.value) aiscript.value.abort();
|
if (aiscript.value) aiscript.value.abort();
|
||||||
started.value = false;
|
started.value = false;
|
||||||
|
|
|
@ -31,6 +31,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<button v-tooltip="i18n.ts.shareWithNote" v-click-anime class="_button" @click="shareWithNote"><i class="ti ti-repeat ti-fw"></i></button>
|
<button v-tooltip="i18n.ts.shareWithNote" v-click-anime class="_button" @click="shareWithNote"><i class="ti ti-repeat ti-fw"></i></button>
|
||||||
<button v-tooltip="i18n.ts.copyLink" v-click-anime class="_button" @click="copyLink"><i class="ti ti-link ti-fw"></i></button>
|
<button v-tooltip="i18n.ts.copyLink" v-click-anime class="_button" @click="copyLink"><i class="ti ti-link ti-fw"></i></button>
|
||||||
<button v-if="isSupportShare()" v-tooltip="i18n.ts.share" v-click-anime class="_button" @click="share"><i class="ti ti-share ti-fw"></i></button>
|
<button v-if="isSupportShare()" v-tooltip="i18n.ts.share" v-click-anime class="_button" @click="share"><i class="ti ti-share ti-fw"></i></button>
|
||||||
|
<button v-if="$i && $i.id !== post.user.id" v-click-anime class="_button" @mousedown="showMenu"><i class="ti ti-dots ti-fw"></i></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="user">
|
<div class="user">
|
||||||
|
@ -62,7 +63,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, watch, ref } from 'vue';
|
import { computed, watch, ref, defineAsyncComponent } from 'vue';
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
import MkButton from '@/components/MkButton.vue';
|
import MkButton from '@/components/MkButton.vue';
|
||||||
import * as os from '@/os.js';
|
import * as os from '@/os.js';
|
||||||
|
@ -79,6 +80,7 @@ import { $i } from '@/account.js';
|
||||||
import { isSupportShare } from '@/scripts/navigator.js';
|
import { isSupportShare } from '@/scripts/navigator.js';
|
||||||
import { copyToClipboard } from '@/scripts/copy-to-clipboard.js';
|
import { copyToClipboard } from '@/scripts/copy-to-clipboard.js';
|
||||||
import { useRouter } from '@/router/supplier.js';
|
import { useRouter } from '@/router/supplier.js';
|
||||||
|
import { MenuItem } from '@/types/menu';
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
|
@ -153,13 +155,54 @@ function edit() {
|
||||||
router.push(`/gallery/${post.value.id}/edit`);
|
router.push(`/gallery/${post.value.id}/edit`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function reportAbuse() {
|
||||||
|
if (!post.value) return;
|
||||||
|
|
||||||
|
const pageUrl = `${url}/gallery/${post.value.id}`;
|
||||||
|
|
||||||
|
os.popup(defineAsyncComponent(() => import('@/components/MkAbuseReportWindow.vue')), {
|
||||||
|
user: post.value.user,
|
||||||
|
initialComment: `Post: ${pageUrl}\n-----\n`,
|
||||||
|
}, {}, 'closed');
|
||||||
|
}
|
||||||
|
|
||||||
|
function showMenu(ev: MouseEvent) {
|
||||||
|
if (!post.value) return;
|
||||||
|
|
||||||
|
const menu: MenuItem[] = [
|
||||||
|
...($i && $i.id !== post.value.userId ? [
|
||||||
|
{
|
||||||
|
icon: 'ti ti-exclamation-circle',
|
||||||
|
text: i18n.ts.reportAbuse,
|
||||||
|
action: reportAbuse,
|
||||||
|
},
|
||||||
|
...($i.isModerator || $i.isAdmin ? [
|
||||||
|
{
|
||||||
|
type: 'divider' as const,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: 'ti ti-trash',
|
||||||
|
text: i18n.ts.delete,
|
||||||
|
danger: true,
|
||||||
|
action: () => os.confirm({
|
||||||
|
type: 'warning',
|
||||||
|
text: i18n.ts.deleteConfirm,
|
||||||
|
}).then(({ canceled }) => {
|
||||||
|
if (canceled || !post.value) return;
|
||||||
|
|
||||||
|
os.apiWithDialog('gallery/posts/delete', { postId: post.value.id });
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
] : []),
|
||||||
|
] : []),
|
||||||
|
];
|
||||||
|
|
||||||
|
os.popupMenu(menu, ev.currentTarget ?? ev.target);
|
||||||
|
}
|
||||||
|
|
||||||
watch(() => props.postId, fetchPost, { immediate: true });
|
watch(() => props.postId, fetchPost, { immediate: true });
|
||||||
|
|
||||||
const headerActions = computed(() => [{
|
const headerActions = computed(() => []);
|
||||||
icon: 'ti ti-pencil',
|
|
||||||
text: i18n.ts.edit,
|
|
||||||
handler: edit,
|
|
||||||
}]);
|
|
||||||
|
|
||||||
const headerTabs = computed(() => []);
|
const headerTabs = computed(() => []);
|
||||||
|
|
||||||
|
|
|
@ -62,8 +62,10 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<MkButton v-else v-tooltip="i18n.ts._pages.like" class="button" asLike @click="like()"><i class="ti ti-heart"></i><span v-if="page.likedCount > 0" class="count">{{ page.likedCount }}</span></MkButton>
|
<MkButton v-else v-tooltip="i18n.ts._pages.like" class="button" asLike @click="like()"><i class="ti ti-heart"></i><span v-if="page.likedCount > 0" class="count">{{ page.likedCount }}</span></MkButton>
|
||||||
</div>
|
</div>
|
||||||
<div :class="$style.other">
|
<div :class="$style.other">
|
||||||
|
<MkA v-if="page.userId === $i?.id" v-tooltip="i18n.ts._pages.editThisPage" :to="`/pages/edit/${page.id}`" class="_button" :class="$style.generalActionButton"><i class="ti ti-pencil ti-fw"></i></MkA>
|
||||||
<button v-tooltip="i18n.ts.copyLink" class="_button" :class="$style.generalActionButton" @click="copyLink"><i class="ti ti-link ti-fw"></i></button>
|
<button v-tooltip="i18n.ts.copyLink" class="_button" :class="$style.generalActionButton" @click="copyLink"><i class="ti ti-link ti-fw"></i></button>
|
||||||
<button v-tooltip="i18n.ts.share" class="_button" :class="$style.generalActionButton" @click="share"><i class="ti ti-share ti-fw"></i></button>
|
<button v-tooltip="i18n.ts.share" class="_button" :class="$style.generalActionButton" @click="share"><i class="ti ti-share ti-fw"></i></button>
|
||||||
|
<button v-if="$i" v-click-anime class="_button" :class="$style.generalActionButton" @mousedown="showMenu"><i class="ti ti-dots ti-fw"></i></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div :class="$style.pageUser">
|
<div :class="$style.pageUser">
|
||||||
|
@ -78,14 +80,6 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<div><i class="ti ti-clock"></i> {{ i18n.ts.createdAt }}: <MkTime :time="page.createdAt" mode="detail"/></div>
|
<div><i class="ti ti-clock"></i> {{ i18n.ts.createdAt }}: <MkTime :time="page.createdAt" mode="detail"/></div>
|
||||||
<div v-if="page.createdAt != page.updatedAt"><i class="ti ti-clock-edit"></i> {{ i18n.ts.updatedAt }}: <MkTime :time="page.updatedAt" mode="detail"/></div>
|
<div v-if="page.createdAt != page.updatedAt"><i class="ti ti-clock-edit"></i> {{ i18n.ts.updatedAt }}: <MkTime :time="page.updatedAt" mode="detail"/></div>
|
||||||
</div>
|
</div>
|
||||||
<div :class="$style.pageLinks">
|
|
||||||
<MkA v-if="!$i || $i.id !== page.userId" :to="`/@${username}/pages/${pageName}/view-source`" class="link">{{ i18n.ts._pages.viewSource }}</MkA>
|
|
||||||
<template v-if="$i && $i.id === page.userId">
|
|
||||||
<MkA :to="`/pages/edit/${page.id}`" class="link">{{ i18n.ts._pages.editThisPage }}</MkA>
|
|
||||||
<button v-if="$i.pinnedPageId === page.id" class="link _textButton" @click="pin(false)">{{ i18n.ts.unpin }}</button>
|
|
||||||
<button v-else class="link _textButton" @click="pin(true)">{{ i18n.ts.pin }}</button>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<MkAd :prefer="['horizontal', 'horizontal-big']"/>
|
<MkAd :prefer="['horizontal', 'horizontal-big']"/>
|
||||||
<MkContainer :max-height="300" :foldable="true" class="other">
|
<MkContainer :max-height="300" :foldable="true" class="other">
|
||||||
|
@ -104,7 +98,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, watch, ref } from 'vue';
|
import { computed, watch, ref, defineAsyncComponent } from 'vue';
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
import XPage from '@/components/page/page.vue';
|
import XPage from '@/components/page/page.vue';
|
||||||
import MkButton from '@/components/MkButton.vue';
|
import MkButton from '@/components/MkButton.vue';
|
||||||
|
@ -126,6 +120,10 @@ import { isSupportShare } from '@/scripts/navigator.js';
|
||||||
import { instance } from '@/instance.js';
|
import { instance } from '@/instance.js';
|
||||||
import { getStaticImageUrl } from '@/scripts/media-proxy.js';
|
import { getStaticImageUrl } from '@/scripts/media-proxy.js';
|
||||||
import { copyToClipboard } from '@/scripts/copy-to-clipboard.js';
|
import { copyToClipboard } from '@/scripts/copy-to-clipboard.js';
|
||||||
|
import { useRouter } from '@/router/supplier.js';
|
||||||
|
import { MenuItem } from '@/types/menu';
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
pageName: string;
|
pageName: string;
|
||||||
|
@ -242,6 +240,67 @@ function pin(pin) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function reportAbuse() {
|
||||||
|
if (!page.value) return;
|
||||||
|
|
||||||
|
const pageUrl = `${url}/@${props.username}/pages/${props.pageName}`;
|
||||||
|
|
||||||
|
os.popup(defineAsyncComponent(() => import('@/components/MkAbuseReportWindow.vue')), {
|
||||||
|
user: page.value.user,
|
||||||
|
initialComment: `Page: ${pageUrl}\n-----\n`,
|
||||||
|
}, {}, 'closed');
|
||||||
|
}
|
||||||
|
|
||||||
|
function showMenu(ev: MouseEvent) {
|
||||||
|
if (!page.value) return;
|
||||||
|
|
||||||
|
const menu: MenuItem[] = [
|
||||||
|
...($i && $i.id === page.value.userId ? [
|
||||||
|
{
|
||||||
|
icon: 'ti ti-code',
|
||||||
|
text: i18n.ts._pages.viewSource,
|
||||||
|
action: () => router.push(`/@${props.username}/pages/${props.pageName}/view-source`),
|
||||||
|
},
|
||||||
|
...($i.pinnedPageId === page.value.id ? [{
|
||||||
|
icon: 'ti ti-pinned-off',
|
||||||
|
text: i18n.ts.unpin,
|
||||||
|
action: () => pin(false),
|
||||||
|
}] : [{
|
||||||
|
icon: 'ti ti-pin',
|
||||||
|
text: i18n.ts.pin,
|
||||||
|
action: () => pin(true),
|
||||||
|
}]),
|
||||||
|
] : []),
|
||||||
|
...($i && $i.id !== page.value.userId ? [
|
||||||
|
{
|
||||||
|
icon: 'ti ti-exclamation-circle',
|
||||||
|
text: i18n.ts.reportAbuse,
|
||||||
|
action: reportAbuse,
|
||||||
|
},
|
||||||
|
...($i.isModerator || $i.isAdmin ? [
|
||||||
|
{
|
||||||
|
type: 'divider' as const,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: 'ti ti-trash',
|
||||||
|
text: i18n.ts.delete,
|
||||||
|
danger: true,
|
||||||
|
action: () => os.confirm({
|
||||||
|
type: 'warning',
|
||||||
|
text: i18n.ts.deleteConfirm,
|
||||||
|
}).then(({ canceled }) => {
|
||||||
|
if (canceled || !page.value) return;
|
||||||
|
|
||||||
|
os.apiWithDialog('pages/delete', { pageId: page.value.id });
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
] : []),
|
||||||
|
] : []),
|
||||||
|
];
|
||||||
|
|
||||||
|
os.popupMenu(menu, ev.currentTarget ?? ev.target);
|
||||||
|
}
|
||||||
|
|
||||||
watch(() => path.value, fetchPage, { immediate: true });
|
watch(() => path.value, fetchPage, { immediate: true });
|
||||||
|
|
||||||
const headerActions = computed(() => []);
|
const headerActions = computed(() => []);
|
||||||
|
|
|
@ -2464,6 +2464,9 @@ type ModerationLog = {
|
||||||
} | {
|
} | {
|
||||||
type: 'unsetUserAvatar';
|
type: 'unsetUserAvatar';
|
||||||
info: ModerationLogPayloads['unsetUserAvatar'];
|
info: ModerationLogPayloads['unsetUserAvatar'];
|
||||||
|
} | {
|
||||||
|
type: 'unsetUserBanner';
|
||||||
|
info: ModerationLogPayloads['unsetUserBanner'];
|
||||||
} | {
|
} | {
|
||||||
type: 'createSystemWebhook';
|
type: 'createSystemWebhook';
|
||||||
info: ModerationLogPayloads['createSystemWebhook'];
|
info: ModerationLogPayloads['createSystemWebhook'];
|
||||||
|
@ -2485,10 +2488,19 @@ type ModerationLog = {
|
||||||
} | {
|
} | {
|
||||||
type: 'deleteAccount';
|
type: 'deleteAccount';
|
||||||
info: ModerationLogPayloads['deleteAccount'];
|
info: ModerationLogPayloads['deleteAccount'];
|
||||||
|
} | {
|
||||||
|
type: 'deletePage';
|
||||||
|
info: ModerationLogPayloads['deletePage'];
|
||||||
|
} | {
|
||||||
|
type: 'deleteFlash';
|
||||||
|
info: ModerationLogPayloads['deleteFlash'];
|
||||||
|
} | {
|
||||||
|
type: 'deleteGalleryPost';
|
||||||
|
info: ModerationLogPayloads['deleteGalleryPost'];
|
||||||
});
|
});
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
export const moderationLogTypes: readonly ["updateServerSettings", "suspend", "unsuspend", "updateUserNote", "addCustomEmoji", "updateCustomEmoji", "deleteCustomEmoji", "assignRole", "unassignRole", "createRole", "updateRole", "deleteRole", "clearQueue", "promoteQueue", "deleteDriveFile", "deleteNote", "createGlobalAnnouncement", "createUserAnnouncement", "updateGlobalAnnouncement", "updateUserAnnouncement", "deleteGlobalAnnouncement", "deleteUserAnnouncement", "resetPassword", "suspendRemoteInstance", "unsuspendRemoteInstance", "updateRemoteInstanceNote", "markSensitiveDriveFile", "unmarkSensitiveDriveFile", "resolveAbuseReport", "createInvitation", "createAd", "updateAd", "deleteAd", "createAvatarDecoration", "updateAvatarDecoration", "deleteAvatarDecoration", "unsetUserAvatar", "unsetUserBanner", "createSystemWebhook", "updateSystemWebhook", "deleteSystemWebhook", "createAbuseReportNotificationRecipient", "updateAbuseReportNotificationRecipient", "deleteAbuseReportNotificationRecipient", "deleteAccount"];
|
export const moderationLogTypes: readonly ["updateServerSettings", "suspend", "unsuspend", "updateUserNote", "addCustomEmoji", "updateCustomEmoji", "deleteCustomEmoji", "assignRole", "unassignRole", "createRole", "updateRole", "deleteRole", "clearQueue", "promoteQueue", "deleteDriveFile", "deleteNote", "createGlobalAnnouncement", "createUserAnnouncement", "updateGlobalAnnouncement", "updateUserAnnouncement", "deleteGlobalAnnouncement", "deleteUserAnnouncement", "resetPassword", "suspendRemoteInstance", "unsuspendRemoteInstance", "updateRemoteInstanceNote", "markSensitiveDriveFile", "unmarkSensitiveDriveFile", "resolveAbuseReport", "createInvitation", "createAd", "updateAd", "deleteAd", "createAvatarDecoration", "updateAvatarDecoration", "deleteAvatarDecoration", "unsetUserAvatar", "unsetUserBanner", "createSystemWebhook", "updateSystemWebhook", "deleteSystemWebhook", "createAbuseReportNotificationRecipient", "updateAbuseReportNotificationRecipient", "deleteAbuseReportNotificationRecipient", "deleteAccount", "deletePage", "deleteFlash", "deleteGalleryPost"];
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type MuteCreateRequest = operations['mute___create']['requestBody']['content']['application/json'];
|
type MuteCreateRequest = operations['mute___create']['requestBody']['content']['application/json'];
|
||||||
|
|
|
@ -155,6 +155,9 @@ export const moderationLogTypes = [
|
||||||
'updateAbuseReportNotificationRecipient',
|
'updateAbuseReportNotificationRecipient',
|
||||||
'deleteAbuseReportNotificationRecipient',
|
'deleteAbuseReportNotificationRecipient',
|
||||||
'deleteAccount',
|
'deleteAccount',
|
||||||
|
'deletePage',
|
||||||
|
'deleteFlash',
|
||||||
|
'deleteGalleryPost',
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
// See: packages/backend/src/core/ReversiService.ts@L410
|
// See: packages/backend/src/core/ReversiService.ts@L410
|
||||||
|
@ -398,4 +401,22 @@ export type ModerationLogPayloads = {
|
||||||
userUsername: string;
|
userUsername: string;
|
||||||
userHost: string | null;
|
userHost: string | null;
|
||||||
};
|
};
|
||||||
|
deletePage: {
|
||||||
|
pageId: string;
|
||||||
|
pageUserId: string;
|
||||||
|
pageUserUsername: string;
|
||||||
|
page: any;
|
||||||
|
};
|
||||||
|
deleteFlash: {
|
||||||
|
flashId: string;
|
||||||
|
flashUserId: string;
|
||||||
|
flashUserUsername: string;
|
||||||
|
flash: any;
|
||||||
|
};
|
||||||
|
deleteGalleryPost: {
|
||||||
|
postId: string;
|
||||||
|
postUserId: string;
|
||||||
|
postUserUsername: string;
|
||||||
|
post: any;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -155,6 +155,9 @@ export type ModerationLog = {
|
||||||
} | {
|
} | {
|
||||||
type: 'unsetUserAvatar';
|
type: 'unsetUserAvatar';
|
||||||
info: ModerationLogPayloads['unsetUserAvatar'];
|
info: ModerationLogPayloads['unsetUserAvatar'];
|
||||||
|
} | {
|
||||||
|
type: 'unsetUserBanner';
|
||||||
|
info: ModerationLogPayloads['unsetUserBanner'];
|
||||||
} | {
|
} | {
|
||||||
type: 'createSystemWebhook';
|
type: 'createSystemWebhook';
|
||||||
info: ModerationLogPayloads['createSystemWebhook'];
|
info: ModerationLogPayloads['createSystemWebhook'];
|
||||||
|
@ -176,6 +179,15 @@ export type ModerationLog = {
|
||||||
} | {
|
} | {
|
||||||
type: 'deleteAccount';
|
type: 'deleteAccount';
|
||||||
info: ModerationLogPayloads['deleteAccount'];
|
info: ModerationLogPayloads['deleteAccount'];
|
||||||
|
} | {
|
||||||
|
type: 'deletePage';
|
||||||
|
info: ModerationLogPayloads['deletePage'];
|
||||||
|
} | {
|
||||||
|
type: 'deleteFlash';
|
||||||
|
info: ModerationLogPayloads['deleteFlash'];
|
||||||
|
} | {
|
||||||
|
type: 'deleteGalleryPost';
|
||||||
|
info: ModerationLogPayloads['deleteGalleryPost'];
|
||||||
});
|
});
|
||||||
|
|
||||||
export type ServerStats = {
|
export type ServerStats = {
|
||||||
|
|
Loading…
Reference in New Issue