Compare commits

...

7 commits

9 changed files with 21 additions and 9 deletions

View file

@ -25,9 +25,9 @@
class="image-attachment" class="image-attachment"
:class="{'hidden': hidden && preloadImage }" :class="{'hidden': hidden && preloadImage }"
:href="attachment.url" target="_blank" :href="attachment.url" target="_blank"
:title="attachment.description"
> >
<StillImage :referrerpolicy="referrerpolicy" :mimetype="attachment.mimetype" :src="attachment.large_thumb_url || attachment.url"/> <StillImage :referrerpolicy="referrerpolicy" :mimetype="attachment.mimetype" :src="attachment.large_thumb_url || attachment.url"
:alt="attachment.description"/>
</a> </a>
<a class="video-container" <a class="video-container"

View file

@ -1,6 +1,6 @@
<template> <template>
<div class="modal-view" v-if="showing" @click.prevent="hide"> <div class="modal-view" v-if="showing" @click.prevent="hide">
<img class="modal-image" v-if="type === 'image'" :src="currentMedia.url"></img> <img class="modal-image" v-if="type === 'image'" :src="currentMedia.url" :alt="currentMedia.description" :title="currentMedia.description"></img>
<VideoAttachment <VideoAttachment
class="modal-image" class="modal-image"
v-if="type === 'video'" v-if="type === 'video'"

View file

@ -67,6 +67,7 @@ const PostStatusForm = {
status: statusText, status: statusText,
nsfw: false, nsfw: false,
files: [], files: [],
mediaDescriptions: {},
visibility: scope visibility: scope
}, },
caret: 0 caret: 0
@ -242,6 +243,7 @@ const PostStatusForm = {
visibility: newStatus.visibility, visibility: newStatus.visibility,
sensitive: newStatus.nsfw, sensitive: newStatus.nsfw,
media: newStatus.files, media: newStatus.files,
mediaDescriptions: newStatus.mediaDescriptions || {},
store: this.$store, store: this.$store,
inReplyToStatusId: this.replyTo, inReplyToStatusId: this.replyTo,
contentType: newStatus.contentType contentType: newStatus.contentType
@ -251,6 +253,7 @@ const PostStatusForm = {
status: '', status: '',
spoilerText: '', spoilerText: '',
files: [], files: [],
mediaDescriptions: {},
visibility: newStatus.visibility, visibility: newStatus.visibility,
contentType: newStatus.contentType contentType: newStatus.contentType
} }

View file

@ -86,6 +86,7 @@
<audio v-if="type(file) === 'audio'" :src="file.image" controls></audio> <audio v-if="type(file) === 'audio'" :src="file.image" controls></audio>
<a v-if="type(file) === 'unknown'" :href="file.image">{{file.url}}</a> <a v-if="type(file) === 'unknown'" :href="file.image">{{file.url}}</a>
</div> </div>
<input type="text" :placeholder="$t('post_status.media_description')" v-model="newStatus.mediaDescriptions[file.id]"></input>
</div> </div>
</div> </div>
<div class="upload_settings" v-if="newStatus.files.length > 0"> <div class="upload_settings" v-if="newStatus.files.length > 0">
@ -158,6 +159,11 @@
border-bottom-left-radius: 0; border-bottom-left-radius: 0;
border-bottom-right-radius: 0; border-bottom-right-radius: 0;
} }
input {
min-width: 300px;
flex: 1;
}
} }
.attachments { .attachments {

View file

@ -3,7 +3,8 @@ const StillImage = {
'src', 'src',
'referrerpolicy', 'referrerpolicy',
'mimetype', 'mimetype',
'imageLoadError' 'imageLoadError',
'alt'
], ],
data () { data () {
return { return {

View file

@ -1,7 +1,7 @@
<template> <template>
<div class='still-image' :class='{ animated: animated }'> <div class='still-image' :class='{ animated: animated }'>
<canvas ref="canvas" v-if="animated"></canvas> <canvas ref="canvas" v-if="animated"></canvas>
<img ref="src" :src="src" :referrerpolicy="referrerpolicy" v-on:load="onLoad" @error="onError"/> <img ref="src" :alt="alt" :title="alt" :src="src" :referrerpolicy="referrerpolicy" v-on:load="onLoad" @error="onError"/>
</div> </div>
</template> </template>

View file

@ -60,6 +60,7 @@
"account_not_locked_warning": "Your account is not {0}. Anyone can follow you to view your follower-only posts.", "account_not_locked_warning": "Your account is not {0}. Anyone can follow you to view your follower-only posts.",
"account_not_locked_warning_link": "locked", "account_not_locked_warning_link": "locked",
"attachments_sensitive": "Mark attachments as sensitive", "attachments_sensitive": "Mark attachments as sensitive",
"media_description": "Media description",
"content_type": { "content_type": {
"plain_text": "Plain text" "plain_text": "Plain text"
}, },

View file

@ -424,7 +424,7 @@ const unretweet = ({ id, credentials }) => {
}) })
} }
const postStatus = ({credentials, status, spoilerText, visibility, sensitive, mediaIds, inReplyToStatusId, contentType, noAttachmentLinks}) => { const postStatus = ({credentials, status, spoilerText, visibility, sensitive, mediaIds, inReplyToStatusId, contentType, noAttachmentLinks, mediaDescriptions}) => {
const idsText = mediaIds.join(',') const idsText = mediaIds.join(',')
const form = new FormData() const form = new FormData()
@ -435,6 +435,7 @@ const postStatus = ({credentials, status, spoilerText, visibility, sensitive, me
if (visibility) form.append('visibility', visibility) if (visibility) form.append('visibility', visibility)
if (sensitive) form.append('sensitive', sensitive) if (sensitive) form.append('sensitive', sensitive)
if (contentType) form.append('content_type', contentType) if (contentType) form.append('content_type', contentType)
form.append('descriptions', JSON.stringify(mediaDescriptions))
form.append('media_ids', idsText) form.append('media_ids', idsText)
if (inReplyToStatusId) { if (inReplyToStatusId) {
form.append('in_reply_to_status_id', inReplyToStatusId) form.append('in_reply_to_status_id', inReplyToStatusId)

View file

@ -1,10 +1,10 @@
import { map } from 'lodash' import { map } from 'lodash'
import apiService from '../api/api.service.js' import apiService from '../api/api.service.js'
const postStatus = ({ store, status, spoilerText, visibility, sensitive, media = [], inReplyToStatusId = undefined, contentType = 'text/plain' }) => { const postStatus = ({ store, status, spoilerText, visibility, sensitive, media = [], inReplyToStatusId = undefined, contentType = 'text/plain', mediaDescriptions = {} }) => {
const mediaIds = map(media, 'id') const mediaIds = map(media, 'id')
return apiService.postStatus({credentials: store.state.users.currentUser.credentials, status, spoilerText, visibility, sensitive, mediaIds, inReplyToStatusId, contentType, noAttachmentLinks: store.state.instance.noAttachmentLinks}) return apiService.postStatus({credentials: store.state.users.currentUser.credentials, status, spoilerText, visibility, sensitive, mediaIds, inReplyToStatusId, contentType, noAttachmentLinks: store.state.instance.noAttachmentLinks, mediaDescriptions})
.then((data) => { .then((data) => {
if (!data.error) { if (!data.error) {
store.dispatch('addNewStatuses', { store.dispatch('addNewStatuses', {