aboutsummaryrefslogtreecommitdiff
path: root/federationapi/federationapi_test.go
diff options
context:
space:
mode:
authorSam Wedgwood <28223854+swedgwood@users.noreply.github.com>2023-08-02 11:12:14 +0100
committerGitHub <noreply@github.com>2023-08-02 11:12:14 +0100
commitc7193e24d06a549b2e4a3bfca2d6e0f6c62d5f80 (patch)
tree19a1284c9d66385618f2f28b1308bb0934744a38 /federationapi/federationapi_test.go
parentaf13fa1c7554fbed802d51421163f81b5b3fbe0d (diff)
Use `*spec.SenderID` for `QuerySenderIDForUser` (#3164)
There are cases where a dendrite instance is unaware of a pseudo ID for a user, the user is not a member of that room. To represent this case, we currently use the 'zero' value, which is often not checked and so causes errors later down the line. To make this case more explict, and to be consistent with `QueryUserIDForSender`, this PR changes this to use a pointer (and `nil` to mean no sender ID). Signed-off-by: `Sam Wedgwood <sam@wedgwood.dev>`
Diffstat (limited to 'federationapi/federationapi_test.go')
-rw-r--r--federationapi/federationapi_test.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/federationapi/federationapi_test.go b/federationapi/federationapi_test.go
index 5d167c0e..c426eb67 100644
--- a/federationapi/federationapi_test.go
+++ b/federationapi/federationapi_test.go
@@ -40,8 +40,9 @@ func (f *fedRoomserverAPI) QueryUserIDForSender(ctx context.Context, roomID spec
return spec.NewUserID(string(senderID), true)
}
-func (f *fedRoomserverAPI) QuerySenderIDForUser(ctx context.Context, roomID spec.RoomID, userID spec.UserID) (spec.SenderID, error) {
- return spec.SenderID(userID.String()), nil
+func (f *fedRoomserverAPI) QuerySenderIDForUser(ctx context.Context, roomID spec.RoomID, userID spec.UserID) (*spec.SenderID, error) {
+ senderID := spec.SenderID(userID.String())
+ return &senderID, nil
}
// PerformJoin will call this function