fix: fix max number of status characters (#2188)

Fixes #2187
This commit is contained in:
Nolan Lawson 2022-11-17 06:17:49 -08:00 committed by GitHub
parent 36ead0406d
commit 6ebd6a6a01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 4 deletions

View File

@ -23,3 +23,5 @@ export const POST_PRIVACY_OPTIONS = [
export const LONG_POST_LENGTH = 1024
export const LONG_POST_TEXT = 'intl.longPost'
export const MAX_STATUS_CHARS = 500

View File

@ -1,5 +1,6 @@
import { DEFAULT_THEME } from '../../_utils/themeEngine.js'
import { mark, stop } from '../../_utils/marks.js'
import { MAX_STATUS_CHARS } from '../../_static/statuses.js'
function computeForInstance (store, computedKey, key, defaultValue) {
store.compute(computedKey,
@ -57,10 +58,18 @@ export function instanceComputations (store) {
store.compute(
'maxStatusChars',
['currentInstanceInfo'],
(currentInstanceInfo) => (
// unofficial api used in glitch-soc and pleroma
(currentInstanceInfo && currentInstanceInfo.max_toot_chars) || 500
)
(currentInstanceInfo) => {
if (currentInstanceInfo) {
if (currentInstanceInfo.max_toot_chars) {
// unofficial api used in glitch-soc and pleroma
return currentInstanceInfo.max_toot_chars
}
if (currentInstanceInfo.configuration && currentInstanceInfo.configuration.statuses && currentInstanceInfo.configuration.statuses.max_characters) {
return currentInstanceInfo.configuration.statuses.max_characters
}
}
return MAX_STATUS_CHARS
}
)
stop('instanceComputations')