invitations: Send 'invites_changed' event for invitations events.

Fixes #7665

In case of invitation events, 'invites_changed' event without
any real payload is sent to all the realm admins and the user.
The event is handled by reloading the list to view recent changes.

Commit tweaked by shubhamdhama:
* Send an `invite_changed` event when an user accept an invite.
    Also, added the test for the same.
* No need to delete the invite list in frontend, current logic
    handles the case when the invite data is changed properly.
* Extracted the common logic for sending an event into
    `notify_invites_changed`.
This commit is contained in:
Aastha Gupta
2017-12-15 02:52:17 +05:30
committed by Tim Abbott
parent 40efac2193
commit dfde4fac85
4 changed files with 77 additions and 1 deletions

View File

@@ -607,6 +607,8 @@ def apply_event(state: Dict[str, Any],
elif event['type'] == "update_global_notifications":
assert event['notification_name'] in UserProfile.notification_setting_types
state[event['notification_name']] = event['setting']
elif event['type'] == "invites_changed":
pass
elif event['type'] == "user_group":
if event['op'] == 'add':
state['realm_user_groups'].append(event['group'])