Skip to content

Commit

Permalink
#118 #106 same as in backend, keep estimations of kicked users or use…
Browse files Browse the repository at this point in the history
…rs that left the room
  • Loading branch information
[email protected] authored and [email protected] committed Sep 24, 2020
1 parent ac53a1b commit 64d5f72
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 36 deletions.
29 changes: 0 additions & 29 deletions client/app/services/clearStoryEstimationsOfUser.js

This file was deleted.

5 changes: 0 additions & 5 deletions client/app/services/eventReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {EVENT_ACTION_TYPES} from '../actions/types';
import clientSettingsStore from '../store/clientSettingsStore';
import initialState from '../store/initialState';
import {getCardConfigForValue} from './getCardConfigForValue';
import clearStoryEstimationsOfUser from './clearStoryEstimationsOfUser';

/**
* The event reducer handles backend-event actions.
Expand Down Expand Up @@ -166,13 +165,11 @@ const eventActionHandlers = {
}

// If someone else left the room
const modifiedStories = clearStoryEstimationsOfUser(state.stories, event.userId);
const modifiedUsers = {...state.users};
delete modifiedUsers[event.userId];

return {
...state,
stories: modifiedStories,
users: modifiedUsers
};
},
Expand All @@ -191,13 +188,11 @@ const eventActionHandlers = {
}

// We need to take the userId from the payload (the user that was kicked, not the "kicking" user)
const modifiedStories = clearStoryEstimationsOfUser(state.stories, payload.userId);
const modifiedUsers = {...state.users};
delete modifiedUsers[payload.userId];

return {
...state,
stories: modifiedStories,
users: modifiedUsers
};
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,9 @@ test('Two users in a room, the other one disconnects, then you kick him', () =>
[ownUserId]: startingState.users[ownUserId]
});

// now the estimation of the kicked user was removed
// estimation values are kept, even for kicked users
expect(modifiedState.stories[storyId].estimations).toEqual({
[otherUserId]: 8,
[ownUserId]: 5
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ test('Two users in a room, the other leaves', () => {
description: 'With description',
id: storyId,
estimations: {
/* estimations from leaving user are removed */
[otherUserId]: 8 // we keep estimations of users. mainly because we want to still have these values when exporting (to json file)
},
createdAt: 1592120422988
}
Expand Down

0 comments on commit 64d5f72

Please sign in to comment.