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 person = await db.getAPObject(id, 'Person')
|
||||||
const username = utils.firstIfArray(person.preferredUsername)
|
const username = utils.firstIfArray(person.preferredUsername)
|
||||||
const icon = utils.firstIfArray(person.icon)
|
const icon = utils.firstIfArray(person.icon)
|
||||||
const newicon = {
|
var avatar = { type: 'image/png',
|
||||||
type: utils.firstIfArray(icon.mediaType),
|
url: '/assets/images/default_profile.png' }
|
||||||
url: utils.firstIfArray(icon.url),
|
if (icon !== null) {
|
||||||
|
avatar = {
|
||||||
|
type: utils.firstIfArray(icon.mediaType),
|
||||||
|
url: utils.firstIfArray(icon.url),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var props = {}
|
var props = {}
|
||||||
if (person.attachment !== undefined) {
|
if (person.attachment !== undefined) {
|
||||||
|
@ -120,7 +124,7 @@ async function getAccount(id) {
|
||||||
acct: username+'@'+(new URL(person.id)).hostname,
|
acct: username+'@'+(new URL(person.id)).hostname,
|
||||||
name: utils.firstIfArray(person.name),
|
name: utils.firstIfArray(person.name),
|
||||||
summary: utils.firstIfArray(person.summary),
|
summary: utils.firstIfArray(person.summary),
|
||||||
avatar: newicon,
|
avatar,
|
||||||
username,
|
username,
|
||||||
props,
|
props,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue