Skip to content

Commit

Permalink
provisioning: don't send resolve identifier response fields if nil
Browse files Browse the repository at this point in the history
Signed-off-by: Sumner Evans <[email protected]>
  • Loading branch information
sumnerevans committed Dec 31, 2023
1 parent 07dadf5 commit d643204
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions provisioning.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,13 @@ type Response struct {
Number string `json:"number,omitempty"`

// For response in ResolveIdentifier
ResolveIdentifierResponse
*ResolveIdentifierResponse
}

// ** Start New Chat ** //

type ResolveIdentifierResponse struct {
RoomID string `json:"room_id"`
RoomID id.RoomID `json:"room_id"`
ChatID ResolveIdentifierResponseChatID `json:"chat_id"`
JustCreated bool `json:"just_created"`
OtherUser ResolveIdentifierResponseOtherUser `json:"other_user"`
Expand Down Expand Up @@ -170,7 +170,7 @@ func (prov *ProvisioningAPI) resolveIdentifier(user *User, phoneNum string) (int
puppet := prov.bridge.GetPuppetBySignalIDString(contact.UUID)

return http.StatusOK, &ResolveIdentifierResponse{
RoomID: portal.MXID.String(),
RoomID: portal.MXID,
ChatID: ResolveIdentifierResponseChatID{
UUID: contact.UUID,
Number: phoneNum,
Expand Down Expand Up @@ -207,7 +207,7 @@ func (prov *ProvisioningAPI) ResolveIdentifier(w http.ResponseWriter, r *http.Re
jsonResponse(w, status, Response{
Success: true,
Status: "ok",
ResolveIdentifierResponse: *resp,
ResolveIdentifierResponse: resp,
})
}

Expand Down Expand Up @@ -245,7 +245,7 @@ func (prov *ProvisioningAPI) StartPM(w http.ResponseWriter, r *http.Request) {
return
}
resp.JustCreated = true
resp.RoomID = portal.MXID.String()
resp.RoomID = portal.MXID
}
if resp.JustCreated {
status = http.StatusCreated
Expand All @@ -254,7 +254,7 @@ func (prov *ProvisioningAPI) StartPM(w http.ResponseWriter, r *http.Request) {
jsonResponse(w, status, Response{
Success: true,
Status: "ok",
ResolveIdentifierResponse: *resp,
ResolveIdentifierResponse: resp,
})
}

Expand Down

0 comments on commit d643204

Please sign in to comment.