diff options
| author | zyoshoka <107108195+zyoshoka@users.noreply.github.com> | 2024-08-17 15:01:08 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-17 15:01:08 +0900 |
| commit | fd744f44c1ee7aff71d9dba6096cc9ffcb934271 (patch) | |
| tree | 10edf1a76a915182a87e260bc7c2ba60d337e825 /packages/frontend/src/pages/flash | |
| parent | :art: (diff) | |
| download | sharkey-fd744f44c1ee7aff71d9dba6096cc9ffcb934271.tar.gz sharkey-fd744f44c1ee7aff71d9dba6096cc9ffcb934271.tar.bz2 sharkey-fd744f44c1ee7aff71d9dba6096cc9ffcb934271.zip | |
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 -> ページ
Diffstat (limited to 'packages/frontend/src/pages/flash')
| -rw-r--r-- | packages/frontend/src/pages/flash/flash.vue | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/packages/frontend/src/pages/flash/flash.vue b/packages/frontend/src/pages/flash/flash.vue index 020463a133..7b7f8bb5f2 100644 --- a/packages/frontend/src/pages/flash/flash.vue +++ b/packages/frontend/src/pages/flash/flash.vue @@ -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-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-if="$i && $i.id !== flash.user.id" class="button" rounded @mousedown="showMenu"><i class="ti ti-dots ti-fw"></i></MkButton> </div> </div> </div> @@ -61,7 +62,7 @@ SPDX-License-Identifier: AGPL-3.0-only </template> <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 { Interpreter, Parser, values } from '@syuilo/aiscript'; import MkButton from '@/components/MkButton.vue'; @@ -79,6 +80,7 @@ import { defaultStore } from '@/store.js'; import { $i } from '@/account.js'; import { isSupportShare } from '@/scripts/navigator.js'; import { copyToClipboard } from '@/scripts/copy-to-clipboard.js'; +import { MenuItem } from '@/types/menu'; import { pleaseLogin } from '@/scripts/please-login.js'; 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() { if (aiscript.value) aiscript.value.abort(); started.value = false; |