Unverified Commit eea886ca authored by Sean Hammond's avatar Sean Hammond Committed by GitHub

Merge pull request #1593 from hypothesis/dont-filter-annotations-when-all-students

Don't filter annotations when showing "All Students"
parents 5be86536 27ce9cea
......@@ -169,16 +169,26 @@ const update = {
},
CHANGE_FOCUS_MODE_USER: function(state, action) {
return {
focusMode: {
...state.focusMode,
enabled: true,
focused: true,
config: {
user: { ...action.user },
if (action.user.username === undefined) {
return {
focusMode: {
...state.focusMode,
enabled: false,
focused: false,
},
},
};
};
} else {
return {
focusMode: {
...state.focusMode,
enabled: true,
focused: true,
config: {
user: { ...action.user },
},
},
};
}
},
SET_FORCE_VISIBLE: function(state, action) {
......
......@@ -205,7 +205,7 @@ describe('sidebar/store/modules/selection', () => {
it('sets the focused user and enables focus mode', function() {
store.setFocusModeFocused(false);
store.changeFocusModeUser({
userid: 'testuser',
username: 'testuser',
displayName: 'Test User',
});
assert.equal(store.focusModeUserId(), 'testuser');
......@@ -213,6 +213,23 @@ describe('sidebar/store/modules/selection', () => {
assert.equal(store.focusModeFocused(), true);
assert.equal(store.focusModeEnabled(), true);
});
// When the LMS app wants the client to disable focus mode it sends a
// changeFocusModeUser() RPC call with {username: undefined, displayName:
// undefined}:
//
// https://github.com/hypothesis/lms/blob/d6b88fd7e375a4b23899117556b3e39cfe18986b/lms/static/scripts/frontend_apps/components/LMSGrader.js#L46
//
// This is the LMS app's way of asking the client to disable focus mode.
it('disables focus mode if username is undefined', function() {
store.setFocusModeFocused(true);
store.changeFocusModeUser({
username: undefined,
displayName: undefined,
});
assert.equal(store.focusModeFocused(), false);
assert.equal(store.focusModeEnabled(), false);
});
});
describe('setFocusModeFocused()', function() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment