Adds attachments to the data sent to the server when posting a toot.

Signed-off-by: Cyrille Bollu <cyrpub@bollu.be>
pull/657/head
Cyrille Bollu 2019-08-23 11:38:52 +02:00
rodzic f0fb14e29c
commit a7b84cfeb0
1 zmienionych plików z 8 dodań i 5 usunięć

Wyświetl plik

@ -80,7 +80,7 @@
</emoji-picker>
<masonry>
<div v-for="(item, index) in postAttachments" :key="index">
<div v-for="(item, index) in miniatures" :key="index">
<img :src="item">
</div>
</masonry>
@ -94,7 +94,7 @@
<popover-menu :menu="visibilityPopover" />
</div>
</div>
<label v-tooltip="'Upload image'" class="icon-upload" for="file-upload" />
<label v-tooltip="'Upload image'" class="icon-upload" for="file-upload" />
<input id="file-upload" ref="addAttach" class="upload-button" type="file" @change="uploadImages" />
</div>
</form>
@ -389,7 +389,8 @@ export default {
type: localStorage.getItem('social.lastPostType') || 'followers',
loading: false,
post: '',
postAttachments: [],
miniatures: [], // miniatures of images stored in postAttachments
postAttachments: [], // The toot's attachments
canType: true,
search: '',
replyTo: null,
@ -608,7 +609,8 @@ export default {
canvas.height = imgHeight
ctx.drawImage(img, 0, 0, imgWidth, imgHeight)
var resizedImg = canvas.toDataURL()
self.postAttachments.push(resizedImg)
self.postAttachments.push(Img)
self.miniatures.push(resizedImg)
}
img.src = e.target.result
}
@ -667,7 +669,8 @@ export default {
content: element.innerText.trim(),
to: to,
hashtags: hashtags,
type: this.type
type: this.type,
attachments: this.postAttachments
}
if (this.replyTo) {
data.replyTo = this.replyTo.id