mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 22:27:26 +01:00
Send questInvited webhook to the inviter too (#13111)
This commit is contained in:
@@ -240,6 +240,30 @@ describe('POST /groups/:groupId/quests/invite/:questKey', () => {
|
||||
expect(body.group.name).to.eql(questingGroup.name);
|
||||
expect(body.quest.key).to.eql(PET_QUEST);
|
||||
});
|
||||
|
||||
it('sends quest invited webhook to the inviter too', async () => {
|
||||
const uuid = generateUUID();
|
||||
|
||||
await leader.post('/user/webhook', {
|
||||
url: `http://localhost:${server.port}/webhooks/${uuid}`,
|
||||
type: 'questActivity',
|
||||
enabled: true,
|
||||
options: {
|
||||
questInvited: true,
|
||||
},
|
||||
});
|
||||
|
||||
await leader.post(`/groups/${questingGroup._id}/quests/invite/${PET_QUEST}`);
|
||||
|
||||
await sleep();
|
||||
|
||||
const body = server.getWebhookData(uuid);
|
||||
|
||||
expect(body.type).to.eql('questInvited');
|
||||
expect(body.group.id).to.eql(questingGroup.id);
|
||||
expect(body.group.name).to.eql(questingGroup.name);
|
||||
expect(body.quest.key).to.eql(PET_QUEST);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -149,6 +149,13 @@ api.inviteToQuest = {
|
||||
{ name: 'PARTY_URL', content: '/party' },
|
||||
]);
|
||||
|
||||
// Send webhook to the inviter too
|
||||
questActivityWebhook.send(user, {
|
||||
type: 'questInvited',
|
||||
group,
|
||||
quest,
|
||||
});
|
||||
|
||||
// track that the inviting user has accepted the quest
|
||||
analytics.track('quest', {
|
||||
category: 'behavior',
|
||||
|
||||
Reference in New Issue
Block a user