From 11288fd5c81d51cab2f232983cbf38854e238070 Mon Sep 17 00:00:00 2001 From: tamaina Date: Sat, 13 Feb 2021 03:05:40 +0900 Subject: [PATCH] wip --- src/client/components/post-form.vue | 6 +++++- src/client/pages/share.vue | 25 +++++++++++++++---------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/client/components/post-form.vue b/src/client/components/post-form.vue index d825241ac5..e23d074a96 100644 --- a/src/client/components/post-form.vue +++ b/src/client/components/post-form.vue @@ -116,6 +116,11 @@ export default defineComponent({ type: Boolean, required: false }, + visibleUsers: { + type: Array, + required: false, + default: () => [] + }, initialNote: { type: Object, required: false @@ -149,7 +154,6 @@ export default defineComponent({ cw: null, localOnly: this.$store.state.rememberNoteVisibility ? this.$store.state.localOnly : this.$store.state.defaultNoteLocalOnly, visibility: (this.$store.state.rememberNoteVisibility ? this.$store.state.visibility : this.$store.state.defaultNoteVisibility) as typeof noteVisibilities[number], - visibleUsers: [], autocomplete: null, draghover: false, quoteId: null, diff --git a/src/client/pages/share.vue b/src/client/pages/share.vue index 8951926d1f..24d6fed793 100644 --- a/src/client/pages/share.vue +++ b/src/client/pages/share.vue @@ -54,6 +54,7 @@ export default defineComponent({ visibility: null as string | null, localOnly: null as boolean | null, files: null as any[] | null, + visibleUsers: [] as any[], faShareAlt } @@ -112,16 +113,20 @@ export default defineComponent({ this.renote = obj.object; } } - })(),(async () => { - const specifiedId = urlParams.get('specifiedId'); - const specifiedAcct = urlParams.get('specifiedAcct'); - if (specifiedId) { - this.specified = await os.api('users/show', { - userId: specifiedId - }); - } else if (specifiedAcct) { - this.specified = await os.api('users/show', parseAcct(specifiedAcct)); - } + })(),(() => { + const visibleUserIds = urlParams.get('visibleUserIds'); + if (!visibleUserIds) return; + return Promise.all(visibleUserIds.split(',') + .map(userId => os.api('users/show', { userId }) + .then(user => this.visibleUsers.push(user)) + .catch(() => Error(`invalid userId: ${userId}`)))); + })(),(() => { + const visibleAccts = urlParams.get('visibleAccts'); + if (!visibleAccts) return; + return Promise.all(visibleAccts.split(',') + .map(acct => os.api('users/show', parseAcct(acct)) + .then(user => this.visibleUsers.push(user)) + .catch(() => Error(`invalid acct: ${acct}`)))); })(),(async () => { const fileIds = urlParams.get('fileIds'); if (fileIds) {