From 68037ec443cc25103da6d451b8ce398030a76fc6 Mon Sep 17 00:00:00 2001 From: shpuld Date: Tue, 18 Jun 2019 22:32:49 +0300 Subject: [PATCH] fix broken upload previews, fix poll visibility when logged out --- src/components/media_upload/media_upload.vue | 1 - src/components/poll/poll.js | 5 +- .../post_status_form/post_status_form.js | 7 ++- .../post_status_form/post_status_form.vue | 51 +++++++++++-------- src/i18n/en.json | 2 +- 5 files changed, 40 insertions(+), 26 deletions(-) diff --git a/src/components/media_upload/media_upload.vue b/src/components/media_upload/media_upload.vue index f1c82d89..eb785735 100644 --- a/src/components/media_upload/media_upload.vue +++ b/src/components/media_upload/media_upload.vue @@ -14,7 +14,6 @@ .media-upload { font-size: 26px; min-width: 50px; - flex: 0; } .icon-upload { diff --git a/src/components/poll/poll.js b/src/components/poll/poll.js index e161a069..9d2546f4 100644 --- a/src/components/poll/poll.js +++ b/src/components/poll/poll.js @@ -24,8 +24,11 @@ export default { expired () { return Date.now() > Date.parse(this.poll.expires_at) }, + loggedIn () { + return this.$store.state.users.currentUser + }, showResults () { - return this.poll.voted || this.expired + return this.poll.voted || this.expired || !this.loggedIn }, totalVotesCount () { return this.poll.votes_count diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index ccd3bd8f..eab1c82f 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -291,7 +291,7 @@ const PostStatusForm = { } this.pollFormVisible = false this.$refs.mediaUpload.clearFile() - this.$refs.pollForm.clear() + this.clearPollForm() this.$emit('posted') let el = this.$el.querySelector('textarea') el.style.height = 'auto' @@ -368,6 +368,11 @@ const PostStatusForm = { setPoll (poll) { this.newStatus.poll = poll }, + clearPollForm () { + if (this.$refs.pollForm) { + this.$refs.pollForm.clear() + } + }, dismissScopeNotice () { this.$store.dispatch('setOption', { name: 'hideScopeNotice', value: true }) } diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue index 70fe6629..4f028a23 100644 --- a/src/components/post_status_form/post_status_form.vue +++ b/src/components/post_status_form/post_status_form.vue @@ -104,14 +104,16 @@ @update-poll="setPoll" />
- -
- +
+ +
+ +

{{ charactersLeft }}

{{ charactersLeft }}

@@ -191,6 +193,11 @@ } } + .form-bottom-left { + display: flex; + flex: 1; + } + .text-format { .only-format { color: $fallback--faint; @@ -198,6 +205,20 @@ } } + .poll-icon { + font-size: 26px; + flex: 1; + + .selected { + color: $fallback--lightText; + color: var(--lightText, $fallback--lightText); + } + } + + .icon-chart-bar { + cursor: pointer; + } + .error { text-align: center; @@ -259,7 +280,6 @@ } } - .btn { cursor: pointer; } @@ -315,17 +335,4 @@ z-index: 4; } } -.poll-icon { - font-size: 26px; - flex: 1; - - .selected { - color: $fallback--lightText; - color: var(--lightText, $fallback--lightText); - } -} - -.icon-chart-bar { - cursor: pointer; -} diff --git a/src/i18n/en.json b/src/i18n/en.json index 73f421c8..dd34a95d 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -101,7 +101,7 @@ "single_choice": "Single choice", "multiple_choices": "Multiple choices", "expiry": "Poll age", - "expires_in": "Ends in {0}", + "expires_in": "Poll ends in {0}", "expired": "Poll ended {0} ago", "not_enough_options": "Too few unique options in poll" },