summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2026-01-13 21:15:36 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2026-01-13 21:57:07 +0100
commit70e22576dc6fbd1a8156d4c66f39a260f83479bf (patch)
tree29a9b5a5e0d11fff5699f409c13d8c566fdeec88
parent9e7a29e0f22afbfe5bdc0544735ad31d78758c7c (diff)
Call “accepted” hook only for valid invites
-rw-r--r--src/Erebos/Invite.hs2
-rw-r--r--test/invite.et2
2 files changed, 1 insertions, 3 deletions
diff --git a/src/Erebos/Invite.hs b/src/Erebos/Invite.hs
index faeb646..89670ec 100644
--- a/src/Erebos/Invite.hs
+++ b/src/Erebos/Invite.hs
@@ -188,13 +188,13 @@ instance Service InviteService where
serviceHandler = fromStored >>> \case
AcceptInvite token -> do
- asks (inviteHookAccepted . svcAttributes) >>= ($ token)
invites <- fromSetBy (comparing inviteToken) . lookupSharedValue . lsShared . fromStored <$> getLocalHead
case find ((Just token ==) . inviteToken) invites of
Just invite
| Just name <- inviteContact invite
, [] <- inviteAccepted invite
-> do
+ asks (inviteHookAccepted . svcAttributes) >>= ($ token)
identity <- asks svcPeerIdentity
cdata <- mstore ContactData
{ cdPrev = []
diff --git a/test/invite.et b/test/invite.et
index bf1a45a..c7a8054 100644
--- a/test/invite.et
+++ b/test/invite.et
@@ -62,8 +62,6 @@ test InviteContact:
guard (done == "done")
with p1:
- expect /invite-accepted 00 $p2id/
- expect /invite-accepted $token $p2id/
expect /invite-accepted $token $p2id/
send "contact-list"