Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Fix the MessagePanel test
Browse files Browse the repository at this point in the history
Signed-off-by: Travis Ralston <[email protected]>
  • Loading branch information
turt2live committed Sep 15, 2017
1 parent 3c71898 commit 48f6872
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/structures/MessagePanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
6 changes: 5 additions & 1 deletion test/components/structures/MessagePanel-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 48f6872

Please sign in to comment.