fix: fix max number of status characters

Fixes #2187
This commit is contained in:
Nolan Lawson 2022-11-16 06:58:45 -08:00
parent 1de26d4b06
commit f4a08de9b4
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_LENGTH = 1024
export const LONG_POST_TEXT = 'intl.longPost' 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 { DEFAULT_THEME } from '../../_utils/themeEngine.js'
import { mark, stop } from '../../_utils/marks.js' import { mark, stop } from '../../_utils/marks.js'
import { MAX_STATUS_CHARS } from '../../_static/statuses.js'
function computeForInstance (store, computedKey, key, defaultValue) { function computeForInstance (store, computedKey, key, defaultValue) {
store.compute(computedKey, store.compute(computedKey,
@ -57,10 +58,18 @@ export function instanceComputations (store) {
store.compute( store.compute(
'maxStatusChars', 'maxStatusChars',
['currentInstanceInfo'], ['currentInstanceInfo'],
(currentInstanceInfo) => ( (currentInstanceInfo) => {
if (currentInstanceInfo) {
if (currentInstanceInfo.max_toot_chars) {
// unofficial api used in glitch-soc and pleroma // unofficial api used in glitch-soc and pleroma
(currentInstanceInfo && currentInstanceInfo.max_toot_chars) || 500 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') stop('instanceComputations')