diff options
| author | anatawa12 <anatawa12@icloud.com> | 2023-08-05 13:58:31 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-05 13:58:31 +0900 |
| commit | c5b8766a18d2af25c68e153749dd476a2fd2f869 (patch) | |
| tree | df5571e415c0b77fa8316fcf42db5368d9e8351d /packages/frontend/src/pages | |
| parent | Fix typos (#11450) (diff) | |
| download | misskey-c5b8766a18d2af25c68e153749dd476a2fd2f869.tar.gz misskey-c5b8766a18d2af25c68e153749dd476a2fd2f869.tar.bz2 misskey-c5b8766a18d2af25c68e153749dd476a2fd2f869.zip | |
feat: sensitive channel (#11438)
* feat(backend): add isSensitive to Channel
* feat(backend): support isSensitive in channel endpoints
* feat(frontend/channel-editor): support isSensitive in create/edit channel page
* feat(frontend/channel): show sensitive indicator for sensitive channels
* docs(changelog): add チャンネルをセンシティブ指定できるようになりました
* chore: license header for each file
* chore: add isSensitive of channel to Note object
Diffstat (limited to 'packages/frontend/src/pages')
| -rw-r--r-- | packages/frontend/src/pages/channel-editor.vue | 8 | ||||
| -rw-r--r-- | packages/frontend/src/pages/channel.vue | 14 |
2 files changed, 22 insertions, 0 deletions
diff --git a/packages/frontend/src/pages/channel-editor.vue b/packages/frontend/src/pages/channel-editor.vue index fbf589f244..59d6d14cee 100644 --- a/packages/frontend/src/pages/channel-editor.vue +++ b/packages/frontend/src/pages/channel-editor.vue @@ -20,6 +20,10 @@ SPDX-License-Identifier: AGPL-3.0-only <template #label>{{ i18n.ts.color }}</template> </MkColorInput> + <MkSwitch v-model="isSensitive"> + <template #label>{{ i18n.ts.sensitive }}</template> + </MkSwitch> + <div> <MkButton v-if="bannerId == null" @click="setBannerImage"><i class="ti ti-plus"></i> {{ i18n.ts._channel.setBanner }}</MkButton> <div v-else-if="bannerUrl"> @@ -72,6 +76,7 @@ import { useRouter } from '@/router'; import { definePageMetadata } from '@/scripts/page-metadata'; import { i18n } from '@/i18n'; import MkFolder from '@/components/MkFolder.vue'; +import MkSwitch from "@/components/MkSwitch.vue"; const Sortable = defineAsyncComponent(() => import('vuedraggable').then(x => x.default)); @@ -87,6 +92,7 @@ let description = $ref(null); let bannerUrl = $ref<string | null>(null); let bannerId = $ref<string | null>(null); let color = $ref('#000'); +let isSensitive = $ref(false); const pinnedNotes = ref([]); watch(() => bannerId, async () => { @@ -110,6 +116,7 @@ async function fetchChannel() { description = channel.description; bannerId = channel.bannerId; bannerUrl = channel.bannerUrl; + isSensitive = channel.isSensitive; pinnedNotes.value = channel.pinnedNoteIds.map(id => ({ id, })); @@ -142,6 +149,7 @@ function save() { bannerId: bannerId, pinnedNoteIds: pinnedNotes.value.map(x => x.id), color: color, + isSensitive: isSensitive, }; if (props.channelId) { diff --git a/packages/frontend/src/pages/channel.vue b/packages/frontend/src/pages/channel.vue index 5049b6ba2b..be0917871a 100644 --- a/packages/frontend/src/pages/channel.vue +++ b/packages/frontend/src/pages/channel.vue @@ -17,6 +17,7 @@ SPDX-License-Identifier: AGPL-3.0-only <div><i class="ti ti-users ti-fw"></i><I18n :src="i18n.ts._channel.usersCount" tag="span" style="margin-left: 4px;"><template #n><b>{{ channel.usersCount }}</b></template></I18n></div> <div><i class="ti ti-pencil ti-fw"></i><I18n :src="i18n.ts._channel.notesCount" tag="span" style="margin-left: 4px;"><template #n><b>{{ channel.notesCount }}</b></template></I18n></div> </div> + <div v-if="channel.isSensitive" :class="$style.sensitiveIndicator">{{ i18n.ts.sensitive }}</div> <div :class="$style.bannerFade"></div> </div> <div v-if="channel.description" :class="$style.description"> @@ -274,4 +275,17 @@ definePageMetadata(computed(() => channel ? { .description { padding: 16px; } + +.sensitiveIndicator { + position: absolute; + z-index: 1; + bottom: 16px; + left: 16px; + background: rgba(0, 0, 0, 0.7); + color: var(--warn); + border-radius: 6px; + font-weight: bold; + font-size: 1em; + padding: 4px 7px; +} </style> |