Skip to content

Commit

Permalink
feat: Treat pairing-DM replies as activity
Browse files Browse the repository at this point in the history
  • Loading branch information
jdkaplan committed Sep 4, 2024
1 parent 4830c11 commit 9cb1749
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pairing_bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,20 @@ func (pl *PairingLogic) handle(w http.ResponseWriter, r *http.Request) {
// distinguish these by checking whether there are exactly two participants
// (Pairing Bot + 1).
if len(hook.Message.DisplayRecipient.Users) != 2 {
// But still reset the open pairings count for anyone trying to
// schedule something!
rec, err := pl.rdb.GetByUserID(ctx, hook.Message.SenderID, hook.Message.SenderEmail, hook.Message.SenderFullName)
if err != nil {
log.Println(err)
}

if rec.isSubscribed {
rec.openPairings = 0
if err := pl.rdb.Set(ctx, rec.id, rec); err != nil {
log.Printf("Could not reset openPairings count for user (%d): %s", rec.id, err)
}
}

if err := responder.Encode(zulip.NoResponse()); err != nil {
log.Println(err)
}
Expand Down

0 comments on commit 9cb1749

Please sign in to comment.