Make shortcode optional when emoji is uploaded

This commit is contained in:
Angelina Filippova 2020-04-01 01:12:31 +03:00
parent cea667e0e3
commit 7418324210
2 changed files with 7 additions and 7 deletions

View file

@ -87,7 +87,10 @@ export async function addNewEmojiFile(packName, file, shortcode, filename, host,
url: `/api/pleroma/emoji/packs/${packName}/files`,
method: 'post',
headers: authHeaders(token),
data: { file, shortcode, filename: filename || null }
data: {
file,
shortcode: shortcode.trim() !== '' ? shortcode : null,
filename: filename.trim() !== '' ? filename : null }
})
}

View file

@ -1,7 +1,7 @@
<template>
<el-form :label-position="isMobile ? 'top' : 'left'" label-width="130px" size="small" class="new-emoji-uploader-form">
<el-form-item :label="$t('emoji.shortcode')">
<el-input v-model="shortcode" :placeholder="$t('emoji.required')"/>
<el-input v-model="shortcode" :placeholder="$t('emoji.optional')"/>
</el-form-item>
<el-form-item :label="$t('emoji.customFilename')">
<el-input v-model="customFileName" :placeholder="$t('emoji.optional')"/>
@ -9,7 +9,7 @@
<el-form-item :label="$t('emoji.uploadFile')">
<div class="upload-file-url">
<el-input v-model="imageUploadURL" :placeholder="$t('emoji.url')"/>
<el-button :disabled="shortcodePresent" type="primary" class="upload-button" @click="uploadEmoji">{{ $t('emoji.upload') }}</el-button>
<el-button type="primary" class="upload-button" @click="uploadEmoji">{{ $t('emoji.upload') }}</el-button>
</div>
<div class="upload-container">
<p class="text">or</p>
@ -18,7 +18,7 @@
:multiple="false"
:show-file-list="false"
action="add">
<el-button :disabled="shortcodePresent" type="primary">{{ $t('emoji.clickToUpload') }}</el-button>
<el-button type="primary">{{ $t('emoji.clickToUpload') }}</el-button>
</el-upload>
</div>
</el-form-item>
@ -46,9 +46,6 @@ export default {
},
isMobile() {
return this.$store.state.app.device === 'mobile'
},
shortcodePresent() {
return this.shortcode.trim() === ''
}
},
methods: {