aboutsummaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/components')
-rw-r--r--src/components/chat_panel/chat_panel.vue4
-rw-r--r--src/components/poll/poll_form.js1
-rw-r--r--src/components/post_status_form/post_status_form.js73
-rw-r--r--src/components/post_status_form/post_status_form.vue16
-rw-r--r--src/components/status_content/status_content.vue1
5 files changed, 55 insertions, 40 deletions
diff --git a/src/components/chat_panel/chat_panel.vue b/src/components/chat_panel/chat_panel.vue
index 12968cfb..ca529b5a 100644
--- a/src/components/chat_panel/chat_panel.vue
+++ b/src/components/chat_panel/chat_panel.vue
@@ -10,7 +10,7 @@
@click.stop.prevent="togglePanel"
>
<div class="title">
- <span>{{ $t('chat.title') }}</span>
+ <span>{{ $t('shoutbox.title') }}</span>
<i
v-if="floating"
class="icon-cancel"
@@ -64,7 +64,7 @@
>
<div class="title">
<i class="icon-comment-empty" />
- {{ $t('chat.title') }}
+ {{ $t('shoutbox.title') }}
</div>
</div>
</div>
diff --git a/src/components/poll/poll_form.js b/src/components/poll/poll_form.js
index c0c1ccf7..df93f038 100644
--- a/src/components/poll/poll_form.js
+++ b/src/components/poll/poll_form.js
@@ -75,6 +75,7 @@ export default {
deleteOption (index, event) {
if (this.options.length > 2) {
this.options.splice(index, 1)
+ this.updatePollToParent()
}
},
convertExpiryToUnit (unit, amount) {
diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js
index 6bceed90..e7094bec 100644
--- a/src/components/post_status_form/post_status_form.js
+++ b/src/components/post_status_form/post_status_form.js
@@ -66,6 +66,7 @@ const PostStatusForm = {
StatusContent
},
mounted () {
+ this.updateIdempotencyKey()
this.resize(this.$refs.textarea)
if (this.replyTo) {
@@ -116,7 +117,8 @@ const PostStatusForm = {
dropStopTimeout: null,
preview: null,
previewLoading: false,
- emojiInputShown: false
+ emojiInputShown: false,
+ idempotencyKey: ''
}
},
computed: {
@@ -211,14 +213,43 @@ const PostStatusForm = {
})
},
watch: {
- 'newStatus.contentType': function () {
- this.autoPreview()
- },
- 'newStatus.spoilerText': function () {
- this.autoPreview()
+ 'newStatus': {
+ deep: true,
+ handler () {
+ this.statusChanged()
+ }
}
},
methods: {
+ statusChanged () {
+ this.autoPreview()
+ this.updateIdempotencyKey()
+ },
+ clearStatus () {
+ const newStatus = this.newStatus
+ this.newStatus = {
+ status: '',
+ spoilerText: '',
+ files: [],
+ visibility: newStatus.visibility,
+ contentType: newStatus.contentType,
+ poll: {},
+ mediaDescriptions: {}
+ }
+ this.pollFormVisible = false
+ this.$refs.mediaUpload && this.$refs.mediaUpload.clearFile()
+ this.clearPollForm()
+ if (this.preserveFocus) {
+ this.$nextTick(() => {
+ this.$refs.textarea.focus()
+ })
+ }
+ let el = this.$el.querySelector('textarea')
+ el.style.height = 'auto'
+ el.style.height = undefined
+ this.error = null
+ if (this.preview) this.previewStatus()
+ },
async postStatus (event, newStatus, opts = {}) {
if (this.posting) { return }
if (this.disableSubmit) { return }
@@ -258,36 +289,16 @@ const PostStatusForm = {
store: this.$store,
inReplyToStatusId: this.replyTo,
contentType: newStatus.contentType,
- poll
+ poll,
+ idempotencyKey: this.idempotencyKey
}
const postHandler = this.postHandler ? this.postHandler : statusPoster.postStatus
postHandler(postingOptions).then((data) => {
if (!data.error) {
- this.newStatus = {
- status: '',
- spoilerText: '',
- files: [],
- visibility: newStatus.visibility,
- contentType: newStatus.contentType,
- poll: {},
- mediaDescriptions: {}
- }
- this.pollFormVisible = false
- this.$refs.mediaUpload && this.$refs.mediaUpload.clearFile()
- this.clearPollForm()
+ this.clearStatus()
this.$emit('posted', data)
- if (this.preserveFocus) {
- this.$nextTick(() => {
- this.$refs.textarea.focus()
- })
- }
- let el = this.$el.querySelector('textarea')
- el.style.height = 'auto'
- el.style.height = undefined
- this.error = null
- if (this.preview) this.previewStatus()
} else {
this.error = data.error
}
@@ -404,7 +415,6 @@ const PostStatusForm = {
}
},
onEmojiInputInput (e) {
- this.autoPreview()
this.$nextTick(() => {
this.resize(this.$refs['textarea'])
})
@@ -542,6 +552,9 @@ const PostStatusForm = {
},
handleEmojiInputShow (value) {
this.emojiInputShown = value
+ },
+ updateIdempotencyKey () {
+ this.idempotencyKey = Date.now().toString()
}
}
}
diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue
index 3dcf1f79..7ee9e748 100644
--- a/src/components/post_status_form/post_status_form.vue
+++ b/src/components/post_status_form/post_status_form.vue
@@ -79,10 +79,7 @@
@click.stop.prevent="togglePreview"
>
{{ $t('post_status.preview') }}
- <i
- class="icon-down-open"
- :style="{ transform: showPreview ? 'rotate(0deg)' : 'rotate(-90deg)' }"
- />
+ <i :class="showPreview ? 'icon-left-open' : 'icon-right-open'" />
</a>
<i
v-show="previewLoading"
@@ -374,6 +371,7 @@
}
.preview-heading {
+ padding-left: 0.5em;
display: flex;
width: 100%;
@@ -385,14 +383,16 @@
.preview-toggle {
display: flex;
cursor: pointer;
+ user-select: none;
&:hover {
text-decoration: underline;
}
- }
-
- .icon-down-open {
- transition: transform 0.1s;
+ i {
+ margin-left: 0.2em;
+ font-size: 0.8em;
+ transform: rotate(90deg);
+ }
}
.preview-container {
diff --git a/src/components/status_content/status_content.vue b/src/components/status_content/status_content.vue
index bf8d376e..ab48786c 100644
--- a/src/components/status_content/status_content.vue
+++ b/src/components/status_content/status_content.vue
@@ -275,6 +275,7 @@ $status-margin: 0.75em;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
+ height: 1.4em;
}
}
}