Merge pull request #636 from h3poteto/iss-360
closes #360 Update too max characters if the API responds toot_max_chars
This commit is contained in:
commit
6b2efa97d8
|
@ -129,6 +129,7 @@ export default {
|
|||
})
|
||||
this.$store.dispatch('TimelineSpace/startLocalStreaming', account)
|
||||
this.$store.dispatch('TimelineSpace/fetchEmojis', account)
|
||||
this.$store.dispatch('TimelineSpace/fetchInstance', account)
|
||||
},
|
||||
handleDrop (e) {
|
||||
e.preventDefault()
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
<icon name="hashtag"></icon>
|
||||
</el-button>
|
||||
</div>
|
||||
<span class="text-count">{{ 500 - status.length }}</span>
|
||||
<span class="text-count">{{ tootMax - status.length }}</span>
|
||||
<el-button @click="closeConfirm(close)">{{ $t('modals.new_toot.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="toot" v-loading="blockSubmit">{{ $t('modals.new_toot.toot') }}</el-button>
|
||||
<div class="clearfix"></div>
|
||||
|
@ -125,6 +125,9 @@ export default {
|
|||
}
|
||||
}
|
||||
}),
|
||||
...mapState('TimelineSpace', {
|
||||
tootMax: state => state.tootMax
|
||||
}),
|
||||
...mapGetters('TimelineSpace/Modals/NewToot', [
|
||||
'hashtagInserting'
|
||||
]),
|
||||
|
|
|
@ -21,7 +21,8 @@ const TimelineSpace = {
|
|||
username: ''
|
||||
},
|
||||
loading: false,
|
||||
emojis: []
|
||||
emojis: [],
|
||||
tootMax: 500
|
||||
},
|
||||
mutations: {
|
||||
updateAccount (state, account) {
|
||||
|
@ -37,6 +38,13 @@ const TimelineSpace = {
|
|||
image: e.url
|
||||
}
|
||||
})
|
||||
},
|
||||
updateTootMax (state, value) {
|
||||
if (value) {
|
||||
state.tootMax = value
|
||||
} else {
|
||||
state.tootMax = 500
|
||||
}
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
|
@ -168,6 +176,11 @@ const TimelineSpace = {
|
|||
const data = await Mastodon.get('/custom_emojis', {}, account.baseURL + '/api/v1')
|
||||
commit('updateEmojis', data)
|
||||
return data
|
||||
},
|
||||
async fetchInstance ({ commit }, account) {
|
||||
const data = await Mastodon.get('/instance', {}, account.baseURL + '/api/v1')
|
||||
commit('updateTootMax', data.max_toot_chars)
|
||||
return data
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue