summaryrefslogtreecommitdiff
path: root/packages/frontend/src/pages/channel-editor.vue
diff options
context:
space:
mode:
Diffstat (limited to 'packages/frontend/src/pages/channel-editor.vue')
-rw-r--r--packages/frontend/src/pages/channel-editor.vue66
1 files changed, 33 insertions, 33 deletions
diff --git a/packages/frontend/src/pages/channel-editor.vue b/packages/frontend/src/pages/channel-editor.vue
index 5256ea4f11..af382bb137 100644
--- a/packages/frontend/src/pages/channel-editor.vue
+++ b/packages/frontend/src/pages/channel-editor.vue
@@ -90,22 +90,22 @@ const props = defineProps<{
channelId?: string;
}>();
-let channel = $ref(null);
-let name = $ref(null);
-let description = $ref(null);
-let bannerUrl = $ref<string | null>(null);
-let bannerId = $ref<string | null>(null);
-let color = $ref('#000');
-let isSensitive = $ref(false);
-let allowRenoteToExternal = $ref(true);
+const channel = ref(null);
+const name = ref(null);
+const description = ref(null);
+const bannerUrl = ref<string | null>(null);
+const bannerId = ref<string | null>(null);
+const color = ref('#000');
+const isSensitive = ref(false);
+const allowRenoteToExternal = ref(true);
const pinnedNotes = ref([]);
-watch(() => bannerId, async () => {
- if (bannerId == null) {
- bannerUrl = null;
+watch(() => bannerId.value, async () => {
+ if (bannerId.value == null) {
+ bannerUrl.value = null;
} else {
- bannerUrl = (await os.api('drive/files/show', {
- fileId: bannerId,
+ bannerUrl.value = (await os.api('drive/files/show', {
+ fileId: bannerId.value,
})).url;
}
});
@@ -113,20 +113,20 @@ watch(() => bannerId, async () => {
async function fetchChannel() {
if (props.channelId == null) return;
- channel = await os.api('channels/show', {
+ channel.value = await os.api('channels/show', {
channelId: props.channelId,
});
- name = channel.name;
- description = channel.description;
- bannerId = channel.bannerId;
- bannerUrl = channel.bannerUrl;
- isSensitive = channel.isSensitive;
- pinnedNotes.value = channel.pinnedNoteIds.map(id => ({
+ 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 => ({
id,
}));
- color = channel.color;
- allowRenoteToExternal = channel.allowRenoteToExternal;
+ color.value = channel.value.color;
+ allowRenoteToExternal.value = channel.value.allowRenoteToExternal;
}
fetchChannel();
@@ -150,13 +150,13 @@ function removePinnedNote(index: number) {
function save() {
const params = {
- name: name,
- description: description,
- bannerId: bannerId,
+ name: name.value,
+ description: description.value,
+ bannerId: bannerId.value,
pinnedNoteIds: pinnedNotes.value.map(x => x.id),
- color: color,
- isSensitive: isSensitive,
- allowRenoteToExternal: allowRenoteToExternal,
+ color: color.value,
+ isSensitive: isSensitive.value,
+ allowRenoteToExternal: allowRenoteToExternal.value,
};
if (props.channelId) {
@@ -172,7 +172,7 @@ function save() {
async function archive() {
const { canceled } = await os.confirm({
type: 'warning',
- title: i18n.t('channelArchiveConfirmTitle', { name: name }),
+ title: i18n.t('channelArchiveConfirmTitle', { name: name.value }),
text: i18n.ts.channelArchiveConfirmDescription,
});
@@ -188,17 +188,17 @@ async function archive() {
function setBannerImage(evt) {
selectFile(evt.currentTarget ?? evt.target, null).then(file => {
- bannerId = file.id;
+ bannerId.value = file.id;
});
}
function removeBannerImage() {
- bannerId = null;
+ bannerId.value = null;
}
-const headerActions = $computed(() => []);
+const headerActions = computed(() => []);
-const headerTabs = $computed(() => []);
+const headerTabs = computed(() => []);
definePageMetadata(computed(() => props.channelId ? {
title: i18n.ts._channel.edit,