From 38f3588dac45c0e8c7ad51711d4ffb553b01cf22 Mon Sep 17 00:00:00 2001 From: Derek Schmidt Date: Sat, 26 Jun 2021 22:11:28 -0700 Subject: [PATCH 1/2] Add rich content (polls, media) to the welcome page notes --- src/client/components/poll.vue | 11 +++++++--- src/client/pages/welcome.timeline.vue | 29 ++++++++++++++++++++++----- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/src/client/components/poll.vue b/src/client/components/poll.vue index 463ddab721..b5d430f93b 100644 --- a/src/client/components/poll.vue +++ b/src/client/components/poll.vue @@ -10,7 +10,7 @@ -

+

{{ $t('_poll.totalVotes', { n: total }) }} ยท {{ showResult ? $ts._poll.vote : $ts._poll.showResult }} @@ -31,6 +31,11 @@ export default defineComponent({ note: { type: Object, required: true + }, + readOnly: { + type: Boolean, + required: false, + default: false, } }, data() { @@ -65,7 +70,7 @@ export default defineComponent({ } }, created() { - this.showResult = this.isVoted; + this.showResult = this.readOnly || this.isVoted; if (this.note.poll.expiresAt) { const update = () => { @@ -83,7 +88,7 @@ export default defineComponent({ this.showResult = !this.showResult; }, vote(id) { - if (this.closed || !this.poll.multiple && this.poll.choices.some(c => c.isVoted)) return; + if (this.readOnly || this.closed || !this.poll.multiple && this.poll.choices.some(c => c.isVoted)) return; os.api('notes/polls/vote', { noteId: this.note.id, choice: id diff --git a/src/client/pages/welcome.timeline.vue b/src/client/pages/welcome.timeline.vue index 12c8a4d4f4..4c06d2fb13 100644 --- a/src/client/pages/welcome.timeline.vue +++ b/src/client/pages/welcome.timeline.vue @@ -1,10 +1,22 @@ @@ -12,11 +24,15 @@