aboutsummaryrefslogtreecommitdiff
path: root/syncapi/types
diff options
context:
space:
mode:
authordevonh <devon.dmytro@gmail.com>2023-06-12 11:19:25 +0000
committerGitHub <noreply@github.com>2023-06-12 11:19:25 +0000
commit77d9e4e93dd01f6baa82bd6236850c1007346cac (patch)
tree20be66224646cc82199028cf89f4cd7fab80b97f /syncapi/types
parent832ccc32f6a023665e250eee44b5f678e985d50e (diff)
Cleanup remaining statekey usage for senderIDs (#3106)
Diffstat (limited to 'syncapi/types')
-rw-r--r--syncapi/types/types.go4
-rw-r--r--syncapi/types/types_test.go8
2 files changed, 9 insertions, 3 deletions
diff --git a/syncapi/types/types.go b/syncapi/types/types.go
index a3dc7f54..cb3c362d 100644
--- a/syncapi/types/types.go
+++ b/syncapi/types/types.go
@@ -539,7 +539,7 @@ type InviteResponse struct {
}
// NewInviteResponse creates an empty response with initialised arrays.
-func NewInviteResponse(event *types.HeaderedEvent, userID spec.UserID) *InviteResponse {
+func NewInviteResponse(event *types.HeaderedEvent, userID spec.UserID, stateKey *string) *InviteResponse {
res := InviteResponse{}
res.InviteState.Events = []json.RawMessage{}
@@ -552,7 +552,7 @@ func NewInviteResponse(event *types.HeaderedEvent, userID spec.UserID) *InviteRe
// Then we'll see if we can create a partial of the invite event itself.
// This is needed for clients to work out *who* sent the invite.
- inviteEvent := synctypes.ToClientEvent(event.PDU, synctypes.FormatSync, userID)
+ inviteEvent := synctypes.ToClientEvent(event.PDU, synctypes.FormatSync, userID, stateKey)
inviteEvent.Unsigned = nil
if ev, err := json.Marshal(inviteEvent); err == nil {
res.InviteState.Events = append(res.InviteState.Events, ev)
diff --git a/syncapi/types/types_test.go b/syncapi/types/types_test.go
index a79ce541..c1b7f70b 100644
--- a/syncapi/types/types_test.go
+++ b/syncapi/types/types_test.go
@@ -65,8 +65,14 @@ func TestNewInviteResponse(t *testing.T) {
if err != nil {
t.Fatal(err)
}
+ skUserID, err := spec.NewUserID("@neilalexander:dendrite.neilalexander.dev", true)
+ if err != nil {
+ t.Fatal(err)
+ }
+ skString := skUserID.String()
+ sk := &skString
- res := NewInviteResponse(&types.HeaderedEvent{PDU: ev}, *sender)
+ res := NewInviteResponse(&types.HeaderedEvent{PDU: ev}, *sender, sk)
j, err := json.Marshal(res)
if err != nil {
t.Fatal(err)