Redux bug fixes (#6243)

* Fix save teams dispatch

* Fix login when MFA is enabled but not active

* Fix JS error caused by using deleted team member
This commit is contained in:
Joram Wilander
2017-04-26 11:07:19 -04:00
committed by GitHub
parent 8e6141152b
commit 1fef5bf5fe
3 changed files with 8 additions and 3 deletions

View File

@@ -631,7 +631,7 @@ export function checkMfa(loginId, success, error) {
checkMfaRedux(loginId)(dispatch, getState).then(
(data) => {
if (data && success) {
if (data != null && success) {
success(data);
} else if (data == null && error) {
const serverError = getState().requests.users.checkMfa.error;

View File

@@ -102,6 +102,9 @@ export default class TeamSidebar extends React.Component {
for (const index in this.state.teamMembers) {
if (this.state.teamMembers.hasOwnProperty(index)) {
const teamMember = this.state.teamMembers[index];
if (teamMember.delete_at > 0) {
continue;
}
const teamId = teamMember.team_id;
myTeams.push(Object.assign({
unread: teamMember.msg_count > 0,

View File

@@ -185,12 +185,14 @@ class TeamStoreClass extends EventEmitter {
}
saveTeam(team) {
this.saveTeams([team]);
const teams = {};
teams[team.id] = team;
this.saveTeams(teams);
}
saveTeams(teams) {
store.dispatch({
type: TeamTypes.RECEIVED_TEAMS_LIST,
type: TeamTypes.RECEIVED_TEAMS,
data: teams
});
}