Add default avatar in accounts.getAccount API
This commit is contained in:
parent
03356275e4
commit
1e698ae289
|
@ -86,9 +86,13 @@ async function getAccount(id) {
|
|||
const person = await db.getAPObject(id, 'Person')
|
||||
const username = utils.firstIfArray(person.preferredUsername)
|
||||
const icon = utils.firstIfArray(person.icon)
|
||||
const newicon = {
|
||||
type: utils.firstIfArray(icon.mediaType),
|
||||
url: utils.firstIfArray(icon.url),
|
||||
var avatar = { type: 'image/png',
|
||||
url: '/assets/images/default_profile.png' }
|
||||
if (icon !== null) {
|
||||
avatar = {
|
||||
type: utils.firstIfArray(icon.mediaType),
|
||||
url: utils.firstIfArray(icon.url),
|
||||
}
|
||||
}
|
||||
var props = {}
|
||||
if (person.attachment !== undefined) {
|
||||
|
@ -120,7 +124,7 @@ async function getAccount(id) {
|
|||
acct: username+'@'+(new URL(person.id)).hostname,
|
||||
name: utils.firstIfArray(person.name),
|
||||
summary: utils.firstIfArray(person.summary),
|
||||
avatar: newicon,
|
||||
avatar,
|
||||
username,
|
||||
props,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue