mirror of
https://github.com/tulir/mautrix-whatsapp
synced 2024-12-14 09:23:51 +01:00
provisioning/contacts: send avatar URL
This commit is contained in:
parent
bc8b0554f6
commit
e133516fed
1 changed files with 16 additions and 1 deletions
|
@ -290,7 +290,22 @@ func (prov *ProvisioningAPI) ListContacts(w http.ResponseWriter, r *http.Request
|
|||
ErrCode: "failed to get contacts",
|
||||
})
|
||||
} else {
|
||||
jsonResponse(w, http.StatusOK, contacts)
|
||||
augmentedContacts := map[types.JID]interface{}{}
|
||||
for jid, contact := range contacts {
|
||||
var avatarUrl id.ContentURI
|
||||
if puppet := prov.bridge.DB.Puppet.Get(jid); puppet != nil {
|
||||
avatarUrl = puppet.AvatarURL
|
||||
}
|
||||
augmentedContacts[jid] = map[string]interface{}{
|
||||
"Found": contact.Found,
|
||||
"FirstName": contact.FirstName,
|
||||
"FullName": contact.FullName,
|
||||
"PushName": contact.PushName,
|
||||
"BusinessName": contact.BusinessName,
|
||||
"AvatarURL": avatarUrl,
|
||||
}
|
||||
}
|
||||
jsonResponse(w, http.StatusOK, augmentedContacts)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue