From 65a4dd15c440c810b77aad41778d39a11b16ea6e Mon Sep 17 00:00:00 2001 From: tamaina Date: Sat, 13 Feb 2021 01:49:22 +0900 Subject: [PATCH] wip --- src/client/components/post-form.vue | 8 ++++++++ src/client/pages/share.vue | 17 +++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/client/components/post-form.vue b/src/client/components/post-form.vue index 76919b468e..d825241ac5 100644 --- a/src/client/components/post-form.vue +++ b/src/client/components/post-form.vue @@ -112,6 +112,10 @@ export default defineComponent({ type: Array, required: false }, + initialLocalOnly: { + type: Boolean, + required: false + }, initialNote: { type: Object, required: false @@ -228,6 +232,10 @@ export default defineComponent({ this.files = this.initialFiles; } + if (typeof this.initialLocalOnly === 'boolean') { + this.localOnly = this.initialLocalOnly; + } + if (this.mention) { this.text = this.mention.host ? `@${this.mention.username}@${toASCII(this.mention.host)}` : `@${this.mention.username}`; this.text += ' '; diff --git a/src/client/pages/share.vue b/src/client/pages/share.vue index fe4e482752..868e6217bc 100644 --- a/src/client/pages/share.vue +++ b/src/client/pages/share.vue @@ -50,6 +50,7 @@ export default defineComponent({ renote: null as any, specified: null as any, visibility: null as string | null, + localOnly: null as boolean | null, files: null as any[] | null, faShareAlt @@ -70,8 +71,20 @@ export default defineComponent({ if (url) noteText += `${url}`; this.initialText = noteText.trim(); - this.visibility = urlParams.get('visibility'); - if (!noteVisibilities.includes(this.visibility)) this.visibility = null; + const visibility = urlParams.get('visibility'); + if (noteVisibilities.includes(visibility)) { + this.visibility = visibility; + } else { + // Mastodonと互換性を持たせてみる + if (this.visibility === 'unlisted') this.visibility = 'home'; + else if (this.visibility === 'private') this.visibility = 'followers'; + else if (this.visibility === 'direct') this.visibility = 'specified'; + else this.visibility = null; + } + + const localOnly = urlParams.get('localOnly'); + if (localOnly === '0') this.localOnly = false; + else if (localOnly === '1') this.localOnly = true; await Promise.all([(async () => { const replyId = urlParams.get('replyId');