Refine SenderID/UserID usage

This commit is contained in:
Devon Hudson 2023-06-02 20:12:00 -06:00
parent b324f7eccc
commit 3582ec7de7
No known key found for this signature in database
GPG key ID: CD06B18E77F6A628
5 changed files with 10 additions and 10 deletions

2
go.mod
View file

@ -22,7 +22,7 @@ require (
github.com/matrix-org/dugong v0.0.0-20210921133753-66e6b1c67e2e
github.com/matrix-org/go-sqlite3-js v0.0.0-20220419092513-28aa791a1c91
github.com/matrix-org/gomatrix v0.0.0-20220926102614-ceba4d9f7530
github.com/matrix-org/gomatrixserverlib v0.0.0-20230602163838-69e05dbabdad
github.com/matrix-org/gomatrixserverlib v0.0.0-20230603021032-d30b8fdc7ced
github.com/matrix-org/pinecone v0.11.1-0.20230210171230-8c3b24f2649a
github.com/matrix-org/util v0.0.0-20221111132719-399730281e66
github.com/mattn/go-sqlite3 v1.14.16

4
go.sum
View file

@ -323,8 +323,8 @@ github.com/matrix-org/go-sqlite3-js v0.0.0-20220419092513-28aa791a1c91 h1:s7fexw
github.com/matrix-org/go-sqlite3-js v0.0.0-20220419092513-28aa791a1c91/go.mod h1:e+cg2q7C7yE5QnAXgzo512tgFh1RbQLC0+jozuegKgo=
github.com/matrix-org/gomatrix v0.0.0-20220926102614-ceba4d9f7530 h1:kHKxCOLcHH8r4Fzarl4+Y3K5hjothkVW5z7T1dUM11U=
github.com/matrix-org/gomatrix v0.0.0-20220926102614-ceba4d9f7530/go.mod h1:/gBX06Kw0exX1HrwmoBibFA98yBk/jxKpGVeyQbff+s=
github.com/matrix-org/gomatrixserverlib v0.0.0-20230602163838-69e05dbabdad h1:l+mNyh4S3v0z320VOFuTIGZLjCAeTenVjYBiUNTZm/o=
github.com/matrix-org/gomatrixserverlib v0.0.0-20230602163838-69e05dbabdad/go.mod h1:H9V9N3Uqn1bBJqYJNGK1noqtgJTaCEhtTdcH/mp50uU=
github.com/matrix-org/gomatrixserverlib v0.0.0-20230603021032-d30b8fdc7ced h1:pbCM+nno+r2wW3jwxP65xmkzk6008CdMNZaOWYBwB1c=
github.com/matrix-org/gomatrixserverlib v0.0.0-20230603021032-d30b8fdc7ced/go.mod h1:H9V9N3Uqn1bBJqYJNGK1noqtgJTaCEhtTdcH/mp50uU=
github.com/matrix-org/pinecone v0.11.1-0.20230210171230-8c3b24f2649a h1:awrPDf9LEFySxTLKYBMCiObelNx/cBuv/wzllvCCH3A=
github.com/matrix-org/pinecone v0.11.1-0.20230210171230-8c3b24f2649a/go.mod h1:HchJX9oKMXaT2xYFs0Ha/6Zs06mxLU8k6F1ODnrGkeQ=
github.com/matrix-org/util v0.0.0-20221111132719-399730281e66 h1:6z4KxomXSIGWqhHcfzExgkH3Z3UkIXry4ibJS4Aqz2Y=

View file

@ -463,10 +463,10 @@ type MembershipQuerier struct {
Roomserver FederationRoomserverAPI
}
func (mq *MembershipQuerier) CurrentMembership(ctx context.Context, roomID spec.RoomID, userID spec.UserID) (string, error) {
func (mq *MembershipQuerier) CurrentMembership(ctx context.Context, roomID spec.RoomID, senderID string) (string, error) {
req := QueryMembershipForUserRequest{
RoomID: roomID.String(),
UserID: userID.String(),
UserID: senderID,
}
res := QueryMembershipForUserResponse{}
err := mq.Roomserver.QueryMembershipForUser(ctx, &req, &res)

View file

@ -989,13 +989,13 @@ func (d *EventDatabase) MaybeRedactEvent(
}
sender1Domain := ""
sender1, err := redactedEvent.UserID()
if err == nil {
sender1, err1 := redactedEvent.UserID()
if err1 == nil {
sender1Domain = string(sender1.Domain())
}
sender2Domain := ""
sender2, err := redactionEvent.UserID()
if err == nil {
sender2, err2 := redactionEvent.UserID()
if err2 == nil {
sender2Domain = string(sender2.Domain())
}
var powerlevels *gomatrixserverlib.PowerLevelContent

View file

@ -224,7 +224,7 @@ func (d *Database) StreamEventsToEvents(device *userapi.Device, in []types.Strea
return out
}
func (d *Database) getSenderIDForUser(roomID string, userID spec.UserID) (string, error) {
func (d *Database) getSenderIDForUser(roomID string, userID spec.UserID) (string, error) { // nolint
// TODO: Repalce with actual logic for pseudoIDs
return userID.String(), nil
}