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.
Этот коммит содержится в:
George Goldberg
2017-04-04 20:17:15 +01:00
коммит произвёл Christopher Speller
родитель 77a76487a8
Коммит 1fa3f2351c
12 изменённых файлов: 770 добавлений и 81 удалений

Просмотреть файл

@@ -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) {