Fix the MessagePanel test
Signed-off-by: Travis Ralston <travpc@gmail.com>pull/21833/head
parent
3c71898237
commit
0363f73e28
|
@ -97,12 +97,12 @@ const COMMANDS = [
|
|||
{
|
||||
command: '/ignore',
|
||||
args: '<user-id>',
|
||||
description: 'Ignores a user, hiding their messages from you'
|
||||
description: 'Ignores a user, hiding their messages from you',
|
||||
},
|
||||
{
|
||||
command: '/unignore',
|
||||
args: '<user-id>',
|
||||
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
|
||||
];
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue