Skip to content

Commit 26b8b55

Browse files
committed
Add some comments.
1 parent 5c21cb5 commit 26b8b55

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

api/invite.go

+3
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,9 @@ func (a *Api) SendInvite(res http.ResponseWriter, req *http.Request, vars map[st
471471

472472
invite.Email = ib.Email
473473
if invitedUsr != nil {
474+
// Not sure if need to another checkForDuplicateInvite here but by userId.
475+
// I suppose it's unlikely person A would invite person B, B accepts, B changes their email,
476+
// and then person A invites B under his new email.
474477
invite.UserId = invitedUsr.UserID
475478
}
476479

clients/mongoStoreClient.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package clients
22

33
import (
44
"context"
5+
stdErrs "errors"
56
"fmt"
67
"regexp"
78

@@ -144,7 +145,7 @@ func (c *MongoStoreClient) FindConfirmation(ctx context.Context, confirmation *m
144145

145146
opts := options.FindOne().SetSort(bson.D{{Key: "created", Value: -1}})
146147

147-
if err = confirmationsCollection(c).FindOne(ctx, query, opts).Decode(&result); err != nil && err != mongo.ErrNoDocuments {
148+
if err = confirmationsCollection(c).FindOne(ctx, query, opts).Decode(&result); err != nil && !stdErrs.Is(err, mongo.ErrNoDocuments) {
148149
return result, err
149150
}
150151

0 commit comments

Comments
 (0)