Merge remote-tracking branch 'upstream/develop' into birthdays
This commit is contained in:
commit
b1e75c25bd
300 changed files with 13879 additions and 9055 deletions
|
|
@ -43,11 +43,13 @@ export const parseUser = (data) => {
|
|||
// case for users in "mentions" property for statuses in MastoAPI
|
||||
const mastoShort = masto && !Object.prototype.hasOwnProperty.call(data, 'avatar')
|
||||
|
||||
output.inLists = null
|
||||
output.id = String(data.id)
|
||||
output._original = data // used for server-side settings
|
||||
|
||||
if (masto) {
|
||||
output.screen_name = data.acct
|
||||
output.fqn = data.fqn
|
||||
output.statusnet_profile_url = data.url
|
||||
|
||||
// There's nothing else to get
|
||||
|
|
@ -90,6 +92,9 @@ export const parseUser = (data) => {
|
|||
output.bot = data.bot
|
||||
|
||||
if (data.pleroma) {
|
||||
if (data.pleroma.settings_store) {
|
||||
output.storage = data.pleroma.settings_store['pleroma-fe']
|
||||
}
|
||||
const relationship = data.pleroma.relationship
|
||||
|
||||
output.background_image = data.pleroma.background_image
|
||||
|
|
@ -121,6 +126,34 @@ export const parseUser = (data) => {
|
|||
}
|
||||
|
||||
output.birthday = data.pleroma.birthday
|
||||
|
||||
if (data.pleroma.privileges) {
|
||||
output.privileges = data.pleroma.privileges
|
||||
} else if (data.pleroma.is_admin) {
|
||||
output.privileges = [
|
||||
'users_read',
|
||||
'users_manage_invites',
|
||||
'users_manage_activation_state',
|
||||
'users_manage_tags',
|
||||
'users_manage_credentials',
|
||||
'users_delete',
|
||||
'messages_read',
|
||||
'messages_delete',
|
||||
'instances_delete',
|
||||
'reports_manage_reports',
|
||||
'moderation_log_read',
|
||||
'announcements_manage_announcements',
|
||||
'emoji_manage_emoji',
|
||||
'statistics_read'
|
||||
]
|
||||
} else if (data.pleroma.is_moderator) {
|
||||
output.privileges = [
|
||||
'messages_delete',
|
||||
'reports_manage_reports'
|
||||
]
|
||||
} else {
|
||||
output.privileges = []
|
||||
}
|
||||
}
|
||||
|
||||
if (data.source) {
|
||||
|
|
@ -214,12 +247,14 @@ export const parseUser = (data) => {
|
|||
output.screen_name_ui = output.screen_name
|
||||
if (output.screen_name && output.screen_name.includes('@')) {
|
||||
const parts = output.screen_name.split('@')
|
||||
let unicodeDomain = punycode.toUnicode(parts[1])
|
||||
const 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_ui_contains_non_ascii = true
|
||||
output.screen_name_ui = [parts[0], unicodeDomain].join('@')
|
||||
} else {
|
||||
output.screen_name_ui_contains_non_ascii = false
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -247,6 +282,16 @@ export const parseAttachment = (data) => {
|
|||
return output
|
||||
}
|
||||
|
||||
export const parseSource = (data) => {
|
||||
const output = {}
|
||||
|
||||
output.text = data.text
|
||||
output.spoiler_text = data.spoiler_text
|
||||
output.content_type = data.content_type
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
export const parseStatus = (data) => {
|
||||
const output = {}
|
||||
const masto = Object.prototype.hasOwnProperty.call(data, 'account')
|
||||
|
|
@ -268,6 +313,8 @@ export const parseStatus = (data) => {
|
|||
|
||||
output.tags = data.tags
|
||||
|
||||
output.edited_at = data.edited_at
|
||||
|
||||
if (data.pleroma) {
|
||||
const { pleroma } = data
|
||||
output.text = pleroma.content ? data.pleroma.content['text/plain'] : data.content
|
||||
|
|
@ -369,6 +416,10 @@ export const parseStatus = (data) => {
|
|||
output.favoritedBy = []
|
||||
output.rebloggedBy = []
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(data, 'originalStatus')) {
|
||||
Object.assign(output, data.originalStatus)
|
||||
}
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
|
|
@ -390,6 +441,13 @@ export const parseNotification = (data) => {
|
|||
: parseUser(data.target)
|
||||
output.from_profile = parseUser(data.account)
|
||||
output.emoji = data.emoji
|
||||
if (data.report) {
|
||||
output.report = data.report
|
||||
output.report.content = data.report.content
|
||||
output.report.acct = parseUser(data.report.account)
|
||||
output.report.actor = parseUser(data.report.actor)
|
||||
output.report.statuses = data.report.statuses.map(parseStatus)
|
||||
}
|
||||
} else {
|
||||
const parsedNotice = parseStatus(data.notice)
|
||||
output.type = data.ntype
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue