summaryrefslogtreecommitdiffstats
path: root/webapp/utils/async_client.jsx
diff options
context:
space:
mode:
authorGeorge Goldberg <george@gberg.me>2017-04-04 20:17:15 +0100
committerChristopher Speller <crspeller@gmail.com>2017-04-04 15:17:15 -0400
commit1fa3f2351c98e4d1b9c198e357d90ac0d436dcaa (patch)
tree23ff5a64041ed6aa1dc6b7a1db85b85972b2ec66 /webapp/utils/async_client.jsx
parent77a76487a8e15084c8b5e8e350eb8dc7a87455ea (diff)
downloadchat-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/utils/async_client.jsx')
-rw-r--r--webapp/utils/async_client.jsx58
1 files changed, 30 insertions, 28 deletions
diff --git a/webapp/utils/async_client.jsx b/webapp/utils/async_client.jsx
index b4b361cb4..faaf3aee6 100644
--- a/webapp/utils/async_client.jsx
+++ b/webapp/utils/async_client.jsx
@@ -403,6 +403,36 @@ export function getProfilesInTeam(teamId = TeamStore.getCurrentId(), offset = Us
);
}
+export function getProfilesNotInTeam(teamId = TeamStore.getCurrentId(), offset = UserStore.getInTeamPagingOffset(), limit = Constants.PROFILE_CHUNK_SIZE) {
+ const callName = `getProfilesNotInTeam${teamId}${offset}${limit}`;
+
+ if (isCallInProgress(callName)) {
+ return;
+ }
+
+ callTracker[callName] = utils.getTimestamp();
+ Client.getProfilesNotInTeam(
+ teamId,
+ offset,
+ limit,
+ (data) => {
+ callTracker[callName] = 0;
+
+ AppDispatcher.handleServerAction({
+ type: ActionTypes.RECEIVED_PROFILES_NOT_IN_TEAM,
+ profiles: data,
+ team_id: teamId,
+ offset,
+ count: Object.keys(data).length
+ });
+ },
+ (err) => {
+ callTracker[callName] = 0;
+ dispatchError(err, 'getProfilesNotInTeam');
+ }
+ );
+}
+
export function getProfilesInChannel(channelId = ChannelStore.getCurrentId(), offset = UserStore.getInChannelPagingOffset(), limit = Constants.PROFILE_CHUNK_SIZE) {
const callName = `getProfilesInChannel${channelId}${offset}${limit}`;
@@ -830,34 +860,6 @@ export function getTeamMember(teamId, userId) {
);
}
-export function getMyTeamMembers() {
- const callName = 'getMyTeamMembers';
- if (isCallInProgress(callName)) {
- return;
- }
-
- callTracker[callName] = utils.getTimestamp();
- Client.getMyTeamMembers(
- (data) => {
- callTracker[callName] = 0;
-
- const members = {};
- for (const member of data) {
- members[member.team_id] = member;
- }
-
- AppDispatcher.handleServerAction({
- type: ActionTypes.RECEIVED_MY_TEAM_MEMBERS_UNREAD,
- team_members: members
- });
- },
- (err) => {
- callTracker[callName] = 0;
- dispatchError(err, 'getMyTeamMembers');
- }
- );
-}
-
export function getMyTeamsUnread(teamId) {
const members = TeamStore.getMyTeamMembers();
if (members.length > 1) {