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_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')