fix: default user language when writing a publication (#1446)

This commit is contained in:
victordelva 2023-01-25 16:41:09 +01:00 committed by GitHub
parent 255c341a78
commit adb17d7f14
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -33,7 +33,7 @@ export function getDefaultDraft(options: Partial<Mutable<mastodon.v1.CreateStatu
visibility: visibility || 'public',
sensitive: sensitive ?? false,
spoilerText: spoilerText || '',
language: language || 'en',
language: language || getDefaultLanguage(),
},
mentions,
lastUpdated: Date.now(),
@ -52,6 +52,16 @@ export async function getDraftFromStatus(status: mastodon.v1.Status): Promise<Dr
})
}
function getDefaultLanguage() {
const userSettings = useUserSettings()
const defaultLanguage = userSettings.value.language
if (defaultLanguage)
return defaultLanguage.split('-')[0]
return 'en'
}
function getAccountsToMention(status: mastodon.v1.Status) {
const userId = currentUser.value?.account.id
const accountsToMention = new Set<string>()