diff --git a/src/autocomplete/CommandProvider.js b/src/autocomplete/CommandProvider.js index ce1be44b41..011ad0a7dc 100644 --- a/src/autocomplete/CommandProvider.js +++ b/src/autocomplete/CommandProvider.js @@ -97,12 +97,12 @@ const COMMANDS = [ { command: '/ignore', args: '', - description: 'Ignores a user, hiding their messages from you' + description: 'Ignores a user, hiding their messages from you', }, { command: '/unignore', args: '', - description: 'Stops ignoring a user, showing their messages going forward' + description: 'Stops ignoring a user, showing their messages going forward', }, // Omitting `/markdown` as it only seems to apply to OldComposer ]; diff --git a/src/components/structures/MessagePanel.js b/src/components/structures/MessagePanel.js index 0124f5d65e..ff0be6d7fe 100644 --- a/src/components/structures/MessagePanel.js +++ b/src/components/structures/MessagePanel.js @@ -241,7 +241,7 @@ module.exports = React.createClass({ // TODO: Implement granular (per-room) hide options _shouldShowEvent: function(mxEv) { - if (MatrixClientPeg.get().isUserIgnored(mxEv.sender.userId)) { + if (mxEv.sender && MatrixClientPeg.get().isUserIgnored(mxEv.sender.userId)) { return false; // ignored = no show (only happens if the ignore happens after an event was received) } diff --git a/test/components/structures/MessagePanel-test.js b/test/components/structures/MessagePanel-test.js index ad7d9c15c7..8254dd4126 100644 --- a/test/components/structures/MessagePanel-test.js +++ b/test/components/structures/MessagePanel-test.js @@ -24,6 +24,7 @@ var sdk = require('matrix-react-sdk'); var MessagePanel = sdk.getComponent('structures.MessagePanel'); import UserSettingsStore from '../../../src/UserSettingsStore'; +import MatrixClientPeg from '../../../src/MatrixClientPeg'; var test_utils = require('test-utils'); var mockclock = require('mock-clock'); @@ -51,16 +52,19 @@ describe('MessagePanel', function () { var clock = mockclock.clock(); var realSetTimeout = window.setTimeout; var events = mkEvents(); + var sandbox = null; beforeEach(function() { test_utils.beforeEach(this); - client = test_utils.createTestClient(); + sandbox = test_utils.stubClient(); + client = MatrixClientPeg.get(); client.credentials = {userId: '@me:here'}; UserSettingsStore.getSyncedSettings = sinon.stub().returns({}); }); afterEach(function() { clock.uninstall(); + sandbox.restore(); }); function mkEvents() {