Skip to content

Commit 3527d20

Browse files
Adding support for event notification.invite_rejected (#467)
Co-authored-by: Anatoly Rugalev <anatoly.rugalev@gmail.com>
1 parent bf9bbb9 commit 3527d20

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

src/events.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export const EVENT_MAP = {
2020
'notification.channel_mutes_updated': true,
2121
'notification.channel_truncated': true,
2222
'notification.invite_accepted': true,
23+
'notification.invite_rejected': true,
2324
'notification.invited': true,
2425
'notification.mark_read': true,
2526
'notification.message_new': true,

src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -905,6 +905,7 @@ export type EventTypes =
905905
| 'notification.channel_mutes_updated'
906906
| 'notification.channel_truncated'
907907
| 'notification.invite_accepted'
908+
| 'notification.invite_rejected'
908909
| 'notification.invited'
909910
| 'notification.mark_read'
910911
| 'notification.message_new'

test/integration/invites.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,13 @@ describe('Member style channel init', () => {
167167
// accept the invite, very similar to a regular update channel...
168168
const nickChannel = nickC.channel('messaging', c.id);
169169
const thierryChannel = thierryC.channel('messaging', c.id);
170+
const inviteRejected = new Promise((resolve) => {
171+
nickC.on('notification.invite_rejected', (e) => {
172+
expect(e.channel).to.be.an('object');
173+
resolve();
174+
});
175+
});
176+
170177
const updateReceived = new Promise((resolve) => {
171178
thierryC.on((e) => {
172179
if (e.type === 'member.updated') {
@@ -180,6 +187,7 @@ describe('Member style channel init', () => {
180187
const response = await nickChannel.rejectInvite();
181188
expect(response.members[1].user.id).to.equal('nick');
182189
expect(response.members[1].invite_rejected_at).to.not.equal(null);
190+
await inviteRejected;
183191
await updateReceived;
184192
// second time should fail...
185193
await expectHTTPErrorCode(400, nickChannel.rejectInvite());

0 commit comments

Comments
 (0)