From b0b2d7f31be455c647f9196d2f36eac2bdeb7fa9 Mon Sep 17 00:00:00 2001 From: Derek Meer Date: Mon, 30 Jul 2018 10:23:25 -0700 Subject: [PATCH] minor changes to fix #560 --- .../clientapi/auth/storage/accounts/storage.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/github.com/matrix-org/dendrite/clientapi/auth/storage/accounts/storage.go b/src/github.com/matrix-org/dendrite/clientapi/auth/storage/accounts/storage.go index b58e0c50e..2650470b8 100644 --- a/src/github.com/matrix-org/dendrite/clientapi/auth/storage/accounts/storage.go +++ b/src/github.com/matrix-org/dendrite/clientapi/auth/storage/accounts/storage.go @@ -144,7 +144,7 @@ func (d *Database) CreateAccount( // SaveMembership saves the user matching a given localpart as a member of a given // room. It also stores the ID of the membership event. -// If a membership already exists between the user and the room, or of the +// If a membership already exists between the user and the room, or if the // insert fails, returns the SQL error func (d *Database) saveMembership( ctx context.Context, txn *sql.Tx, localpart, roomID, eventID string, @@ -152,8 +152,8 @@ func (d *Database) saveMembership( return d.memberships.insertMembership(ctx, txn, localpart, roomID, eventID) } -// removeMembershipsByEventIDs removes the memberships of which the `join` membership -// event ID is included in a given array of events IDs +// removeMembershipsByEventIDs removes the memberships corresponding to the +// `join` membership events IDs in the eventIDs slice. // If the removal fails, or if there is no membership to remove, returns an error func (d *Database) removeMembershipsByEventIDs( ctx context.Context, txn *sql.Tx, eventIDs []string, @@ -204,11 +204,9 @@ func (d *Database) GetMembershipsByLocalpart( return d.memberships.selectMembershipsByLocalpart(ctx, localpart) } -// newMembership will save a new membership in the database. -// If the event isn't a m.room.member event or there's no state key -// (which stores the server name and localpart), does nothing. -// If the event isn't a "join" membership event, does nothing -// If an error occurred, returns it +// newMembership saves a new membership in the database. +// If the event isn't a valid m.room.member event with type `join`, does nothing. +// If an error occurred, returns the SQL error func (d *Database) newMembership( ctx context.Context, txn *sql.Tx, ev gomatrixserverlib.Event, ) error {