summaryrefslogtreecommitdiff
path: root/packages/frontend/src/pages/channel-editor.vue
diff options
context:
space:
mode:
authorsyuilo <4439005+syuilo@users.noreply.github.com>2025-08-26 09:39:23 +0900
committersyuilo <4439005+syuilo@users.noreply.github.com>2025-08-26 09:39:23 +0900
commitdbb6c71c5c7098c33824b6070b6526416d3bdd69 (patch)
tree56a647059e9f18b62d71a4a774ac66be347e194e /packages/frontend/src/pages/channel-editor.vue
parentrefactor (diff)
downloadmisskey-dbb6c71c5c7098c33824b6070b6526416d3bdd69.tar.gz
misskey-dbb6c71c5c7098c33824b6070b6526416d3bdd69.tar.bz2
misskey-dbb6c71c5c7098c33824b6070b6526416d3bdd69.zip
refactor
Diffstat (limited to 'packages/frontend/src/pages/channel-editor.vue')
-rw-r--r--packages/frontend/src/pages/channel-editor.vue37
1 files changed, 21 insertions, 16 deletions
diff --git a/packages/frontend/src/pages/channel-editor.vue b/packages/frontend/src/pages/channel-editor.vue
index 80dfb8e84e..ce26a26109 100644
--- a/packages/frontend/src/pages/channel-editor.vue
+++ b/packages/frontend/src/pages/channel-editor.vue
@@ -92,7 +92,7 @@ const props = defineProps<{
}>();
const channel = ref<Misskey.entities.Channel | null>(null);
-const name = ref<string | null>(null);
+const name = ref<string>('');
const description = ref<string | null>(null);
const bannerUrl = ref<string | null>(null);
const bannerId = ref<string | null>(null);
@@ -114,20 +114,22 @@ watch(() => bannerId.value, async () => {
async function fetchChannel() {
if (props.channelId == null) return;
- channel.value = await misskeyApi('channels/show', {
+ const result = await misskeyApi('channels/show', {
channelId: props.channelId,
});
- name.value = channel.value.name;
- description.value = channel.value.description;
- bannerId.value = channel.value.bannerId;
- bannerUrl.value = channel.value.bannerUrl;
- isSensitive.value = channel.value.isSensitive;
- pinnedNotes.value = channel.value.pinnedNoteIds.map(id => ({
+ name.value = result.name;
+ description.value = result.description;
+ bannerId.value = result.bannerId;
+ bannerUrl.value = result.bannerUrl;
+ isSensitive.value = result.isSensitive;
+ pinnedNotes.value = result.pinnedNoteIds.map(id => ({
id,
}));
- color.value = channel.value.color;
- allowRenoteToExternal.value = channel.value.allowRenoteToExternal;
+ color.value = result.color;
+ allowRenoteToExternal.value = result.allowRenoteToExternal;
+
+ channel.value = result;
}
fetchChannel();
@@ -154,15 +156,17 @@ function save() {
name: name.value,
description: description.value,
bannerId: bannerId.value,
- pinnedNoteIds: pinnedNotes.value.map(x => x.id),
color: color.value,
isSensitive: isSensitive.value,
allowRenoteToExternal: allowRenoteToExternal.value,
- };
+ } satisfies Misskey.entities.ChannelsCreateRequest;
- if (props.channelId) {
- params.channelId = props.channelId;
- os.apiWithDialog('channels/update', params);
+ if (props.channelId != null) {
+ os.apiWithDialog('channels/update', {
+ ...params,
+ channelId: props.channelId,
+ pinnedNoteIds: pinnedNotes.value.map(x => x.id),
+ });
} else {
os.apiWithDialog('channels/create', params).then(created => {
router.push('/channels/:channelId', {
@@ -175,12 +179,13 @@ function save() {
}
async function archive() {
+ if (props.channelId == null) return;
+
const { canceled } = await os.confirm({
type: 'warning',
title: i18n.tsx.channelArchiveConfirmTitle({ name: name.value }),
text: i18n.ts.channelArchiveConfirmDescription,
});
-
if (canceled) return;
misskeyApi('channels/update', {