Skip to content

Commit

Permalink
Merge pull request #4099 from h3poteto/fix/char-limit
Browse files Browse the repository at this point in the history
Show character limit in compose
  • Loading branch information
h3poteto authored Feb 8, 2023
2 parents e42ad4d + 4894ded commit 66b672e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
13 changes: 11 additions & 2 deletions src/renderer/components/TimelineSpace/Compose.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
<el-button link size="default" @click="cw = !cw"> CW </el-button>
</el-button-group>
<div class="actions-group">
<span>500</span>
<span>{{ statusChars }}</span>
<el-button type="primary" @click="post" :loading="loading"> {{ $t('modals.new_toot.toot') }} </el-button>
</div>
</div>
Expand Down Expand Up @@ -204,6 +204,9 @@ export default defineComponent({
const dropTarget = ref<any>(null)
const droppableVisible = ref<boolean>(false)
const maxStatusChars = ref<number>(500)
const statusChars = computed(() => maxStatusChars.value - (form.status.length + form.spoiler.length))
onMounted(async () => {
const [a, s]: [LocalAccount, LocalServer] = await win.ipcRenderer.invoke('get-local-account', id.value)
const c = generator(s.sns, s.baseURL, a.accessToken, userAgent.value)
Expand All @@ -215,6 +218,11 @@ export default defineComponent({
nsfw.value = credentials.data.source.sensitive
}
const instance = await c.getInstance()
if (instance.data.max_toot_chars) {
maxStatusChars.value = instance.data.max_toot_chars
}
const emojis = await c.getInstanceCustomEmojis()
const customEmojis = emojis.data
.map(emoji => {
Expand Down Expand Up @@ -442,7 +450,8 @@ export default defineComponent({
removePollOption,
droppableVisible,
inReplyTo,
clearReply
clearReply,
statusChars
}
}
})
Expand Down
3 changes: 0 additions & 3 deletions src/renderer/components/event.ts

This file was deleted.

0 comments on commit 66b672e

Please sign in to comment.