mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-25 19:04:04 +02:00
feat: 投稿通知設定したユーザーをリストで見ることができるように (#17385)
* feat: 投稿通知を設定したユーザーをリストで見ることができるように * test(e2e): 投稿通知のテスト追加 * chore: 不必要なコードの削除
This commit is contained in:
@@ -36,6 +36,28 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
</MkFolder>
|
||||
</div>
|
||||
</FormSection>
|
||||
|
||||
<FormSection>
|
||||
<SearchMarker
|
||||
:keywords="['notify', 'hide', 'user']"
|
||||
>
|
||||
<MkFolder>
|
||||
<template #label><SearchLabel>{{ i18n.ts.notifyUsers }}</SearchLabel></template>
|
||||
<MkPagination v-slot="{items}" :paginator="notifyUserPaginator" withControl>
|
||||
<div class="_gaps_s">
|
||||
<div v-for="item in items" :key="item.id" :class="[$style.userItem ]">
|
||||
<div :class="$style.userItemMain">
|
||||
<MkA :class="$style.userItemMainBody" :to="userPage(item)">
|
||||
<MkUserCardMini :user="item"/>
|
||||
</MkA>
|
||||
<button class="_button" :class="$style.notifyMenu" @click="showNotifyMenu(item, $event)"><i class="ti ti-dots"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</MkPagination>
|
||||
</MkFolder>
|
||||
</SearchMarker>
|
||||
</FormSection>
|
||||
<FormSection>
|
||||
<div class="_gaps_m">
|
||||
<FormLink to="/settings/sounds">{{ i18n.ts.notificationSoundSettings }}</FormLink>
|
||||
@@ -64,8 +86,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useTemplateRef, computed } from 'vue';
|
||||
import { useTemplateRef, computed, ref, markRaw } from 'vue';
|
||||
import { notificationTypes } from 'misskey-js';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import XNotificationConfig from './notifications.notification-config.vue';
|
||||
import type { NotificationConfig } from './notifications.notification-config.vue';
|
||||
import FormLink from '@/components/form/link.vue';
|
||||
@@ -80,9 +103,32 @@ import { i18n } from '@/i18n.js';
|
||||
import { definePage } from '@/page.js';
|
||||
import MkPushNotificationAllowButton from '@/components/MkPushNotificationAllowButton.vue';
|
||||
import MkFeatureBanner from '@/components/MkFeatureBanner.vue';
|
||||
import { Paginator } from '@/utility/paginator.js';
|
||||
import MkPagination from '@/components/MkPagination.vue';
|
||||
import { userPage } from '@/filters/user.js';
|
||||
import MkUserCardMini from '@/components/MkUserCardMini.vue';
|
||||
|
||||
const $i = ensureSignin();
|
||||
|
||||
async function showNotifyMenu(user: Misskey.entities.UserDetailed, ev: PointerEvent) {
|
||||
os.popupMenu([{
|
||||
text: (user.notify === 'normal') ? i18n.ts.unnotifyNotes : i18n.ts.notifyNotes,
|
||||
icon: (user.notify === 'normal') ? 'ti ti-x' : 'ti ti-plus',
|
||||
action: async () => {
|
||||
await os.apiWithDialog('following/update', {
|
||||
userId: user.id,
|
||||
notify: user.notify === 'normal' ? 'none' : 'normal',
|
||||
}).then(() => {
|
||||
user.notify = user.notify === 'normal' ? 'none' : 'normal';
|
||||
});
|
||||
},
|
||||
}], ev.currentTarget ?? ev.target);
|
||||
}
|
||||
|
||||
const notifyUserPaginator = markRaw(new Paginator('users/notify/list', {
|
||||
limit: 10,
|
||||
}));
|
||||
|
||||
const nonConfigurableNotificationTypes = ['note', 'roleAssigned', 'followRequestAccepted', 'test', 'exportCompleted'] as const satisfies (typeof notificationTypes[number])[];
|
||||
|
||||
const configurableNotificationTypes = notificationTypes.filter(type => !nonConfigurableNotificationTypes.includes(type as any)) as Exclude<typeof notificationTypes[number], typeof nonConfigurableNotificationTypes[number]>[];
|
||||
@@ -145,3 +191,25 @@ definePage(() => ({
|
||||
icon: 'ti ti-bell',
|
||||
}));
|
||||
</script>
|
||||
|
||||
<style lang="scss" module>
|
||||
.userItemMain {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.userItemMainBody {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
margin-right: 8px;
|
||||
|
||||
&:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
|
||||
.notifyMenu {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
align-self: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user