Merge branch 'develop' of git.pleroma.social:pleroma/pleroma-fe into develop
This commit is contained in:
commit
87ae0eaa15
30 changed files with 549 additions and 494 deletions
|
@ -1,6 +1,7 @@
|
|||
import escape from 'escape-html'
|
||||
import parseLinkHeader from 'parse-link-header'
|
||||
import { isStatusNotification } from '../notification_utils/notification_utils.js'
|
||||
import punycode from 'punycode.js'
|
||||
|
||||
/** NOTICE! **
|
||||
* Do not initialize UI-generated data here.
|
||||
|
@ -187,7 +188,12 @@ export const parseUser = (data) => {
|
|||
output.follow_request_count = data.pleroma.follow_request_count
|
||||
|
||||
output.tags = data.pleroma.tags
|
||||
output.deactivated = data.pleroma.deactivated
|
||||
|
||||
// deactivated was changed to is_active in Pleroma 2.3.0
|
||||
// so check if is_active is present
|
||||
output.deactivated = typeof data.pleroma.is_active !== 'undefined'
|
||||
? !data.pleroma.is_active // new backend
|
||||
: data.pleroma.deactivated // old backend
|
||||
|
||||
output.notification_settings = data.pleroma.notification_settings
|
||||
output.unread_chat_count = data.pleroma.unread_chat_count
|
||||
|
@ -197,6 +203,18 @@ export const parseUser = (data) => {
|
|||
output.rights = output.rights || {}
|
||||
output.notification_settings = output.notification_settings || {}
|
||||
|
||||
// Convert punycode to unicode
|
||||
if (output.screen_name.includes('@')) {
|
||||
const parts = output.screen_name.split('@')
|
||||
let unicodeDomain = punycode.toUnicode(parts[1])
|
||||
if (unicodeDomain !== parts[1]) {
|
||||
// Add some identifier so users can potentially spot spoofing attempts:
|
||||
// lain.com and xn--lin-6cd.com would appear identical otherwise.
|
||||
unicodeDomain = '🌏' + unicodeDomain
|
||||
output.screen_name = [parts[0], unicodeDomain].join('@')
|
||||
}
|
||||
}
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
|
|
12
src/services/locale/locale.service.js
Normal file
12
src/services/locale/locale.service.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
const specialLanguageCodes = {
|
||||
'ja_easy': 'ja',
|
||||
'zh_Hant': 'zh-HANT'
|
||||
}
|
||||
|
||||
const internalToBrowserLocale = code => specialLanguageCodes[code] || code
|
||||
|
||||
const localeService = {
|
||||
internalToBrowserLocale
|
||||
}
|
||||
|
||||
export default localeService
|
Loading…
Add table
Add a link
Reference in a new issue