Don't filter annotations when showing "All Students"

When the client is running in the LMS app and in grading mode, don't
apply a broken filter to the annotations list when the LMS app is asking
the client to show "All Students".

Fixes https://github.com/hypothesis/lms/issues/1259
parent 84e7186d
......@@ -169,6 +169,15 @@ const update = {
},
CHANGE_FOCUS_MODE_USER: function(state, action) {
if (action.user.username === undefined) {
return {
focusMode: {
...state.focusMode,
enabled: false,
focused: false,
},
};
} else {
return {
focusMode: {
...state.focusMode,
......@@ -179,6 +188,7 @@ const update = {
},
},
};
}
},
SET_FORCE_VISIBLE: function(state, action) {
......
......@@ -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