diff options
author | Sam Wedgwood <28223854+swedgwood@users.noreply.github.com> | 2023-08-02 11:12:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-02 11:12:14 +0100 |
commit | c7193e24d06a549b2e4a3bfca2d6e0f6c62d5f80 (patch) | |
tree | 19a1284c9d66385618f2f28b1308bb0934744a38 /userapi | |
parent | af13fa1c7554fbed802d51421163f81b5b3fbe0d (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 'userapi')
-rw-r--r-- | userapi/consumers/roomserver.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/userapi/consumers/roomserver.go b/userapi/consumers/roomserver.go index 1f866ef4..a88b2129 100644 --- a/userapi/consumers/roomserver.go +++ b/userapi/consumers/roomserver.go @@ -840,8 +840,11 @@ func (s *OutputRoomEventConsumer) notifyHTTP(ctx context.Context, event *rstypes if err != nil { logger.WithError(err).Errorf("Failed to get local user senderID for room %s: %s", userID.String(), event.RoomID()) return nil, err + } else if localSender == nil { + logger.WithError(err).Errorf("Failed to get local user senderID for room %s: %s", userID.String(), event.RoomID()) + return nil, fmt.Errorf("no sender ID for user %s in %s", userID.String(), roomID.String()) } - if event.StateKey() != nil && *event.StateKey() == string(localSender) { + if event.StateKey() != nil && *event.StateKey() == string(*localSender) { req.Notification.UserIsTarget = true } } |