diff options
author | George Goldberg <george@gberg.me> | 2017-04-04 20:17:15 +0100 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2017-04-04 15:17:15 -0400 |
commit | 1fa3f2351c98e4d1b9c198e357d90ac0d436dcaa (patch) | |
tree | 23ff5a64041ed6aa1dc6b7a1db85b85972b2ec66 /webapp/actions/team_actions.jsx | |
parent | 77a76487a8e15084c8b5e8e350eb8dc7a87455ea (diff) | |
download | chat-1fa3f2351c98e4d1b9c198e357d90ac0d436dcaa.tar.gz chat-1fa3f2351c98e4d1b9c198e357d90ac0d436dcaa.tar.bz2 chat-1fa3f2351c98e4d1b9c198e357d90ac0d436dcaa.zip |
PLT-6023: Add Users to Team in WebApp. (#5956)
* PLT-6198: Use added to channel system message on default channels.
Use a different sytem message when a user was added to a default channel
by someone else than when they joined themselves.
* PLT-6023: Add Users to Team in WebApp.
* Fix string text.
* Handle added_to_team websocket message.
* Fix unread flag on new channel.
Diffstat (limited to 'webapp/actions/team_actions.jsx')
-rw-r--r-- | webapp/actions/team_actions.jsx | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/webapp/actions/team_actions.jsx b/webapp/actions/team_actions.jsx index 4cb57961b..b091692f8 100644 --- a/webapp/actions/team_actions.jsx +++ b/webapp/actions/team_actions.jsx @@ -114,6 +114,31 @@ export function addUserToTeamFromInvite(data, hash, inviteId, success, error) { ); } +export function addUsersToTeam(teamId, userIds, success, error) { + Client.addUsersToTeam( + teamId, + userIds, + (teamMembers) => { + teamMembers.forEach((member) => { + TeamStore.removeMemberNotInTeam(teamId, member.user_id); + UserStore.removeProfileNotInTeam(teamId, member.user_id); + }); + UserStore.emitNotInTeamChange(); + + if (success) { + success(teamMembers); + } + }, + (err) => { + AsyncClient.dispatchError(err, 'addUsersToTeam'); + + if (error) { + error(err); + } + } + ); +} + export function getInviteInfo(inviteId, success, error) { Client.getInviteInfo( inviteId, |