forked from MirrorHub/mautrix-whatsapp
Check errors for GetGroupMetaData
When a request for GroupMetadata fails, WhatsApp sends an JSON object containing a status field: `{"status":500}`. In my tests, it sends the codes 401, 404 and 500 which might have the meaning of the HTTP status codes. At least, we don't have data to update the portal and should stop doing anything.
This commit is contained in:
parent
abab28f8a7
commit
abe73684d0
2 changed files with 12 additions and 0 deletions
10
portal.go
10
portal.go
|
@ -316,6 +316,16 @@ func (portal *Portal) UpdateMetadata(user *User) bool {
|
|||
portal.log.Errorln(err)
|
||||
return false
|
||||
}
|
||||
if metadata.Status != 0 {
|
||||
// 401: access denied
|
||||
// 404: group does (no longer) exist
|
||||
// 500: ??? happens with status@broadcast
|
||||
|
||||
// TODO: update the room, e.g. change priority level
|
||||
// to send messages to moderator
|
||||
return false
|
||||
}
|
||||
|
||||
portal.SyncParticipants(metadata)
|
||||
update := false
|
||||
update = portal.UpdateName(metadata.Name, metadata.NameSetBy) || update
|
||||
|
|
|
@ -61,6 +61,8 @@ type GroupInfo struct {
|
|||
|
||||
GroupCreated int64 `json:"creation"`
|
||||
|
||||
Status int16 `json:"status"`
|
||||
|
||||
Participants []struct {
|
||||
JID string `json:"id"`
|
||||
IsAdmin bool `json:"isAdmin"`
|
||||
|
|
Loading…
Reference in a new issue