Fix the tests

Signed-off-by: Travis Ralston <travpc@gmail.com>
This commit is contained in:
Travis Ralston 2017-11-05 14:56:41 -07:00
parent f0000f7400
commit 10519f9465
3 changed files with 18 additions and 13 deletions

View file

@ -1096,12 +1096,14 @@ module.exports = React.createClass({
krh.handleKeyRequestCancellation(req); krh.handleKeyRequestCancellation(req);
}); });
cli.on("Room", (room) => { cli.on("Room", (room) => {
if (MatrixClientPeg.get().isCryptoEnabled()) {
const blacklistEnabled = SettingsStore.getValueAt( const blacklistEnabled = SettingsStore.getValueAt(
SettingLevel.ROOM_DEVICE, SettingLevel.ROOM_DEVICE,
"blacklistUnverifiedDevices", "blacklistUnverifiedDevices",
room.roomId, room.roomId,
); );
room.setBlacklistUnverifiedDevices(blacklistEnabled); room.setBlacklistUnverifiedDevices(blacklistEnabled);
}
}); });
}, },
@ -1113,11 +1115,13 @@ module.exports = React.createClass({
_onClientStarted: function() { _onClientStarted: function() {
const cli = MatrixClientPeg.get(); const cli = MatrixClientPeg.get();
if (cli.isCryptoEnabled()) {
const blacklistEnabled = SettingsStore.getValueAt( const blacklistEnabled = SettingsStore.getValueAt(
SettingLevel.DEVICE, SettingLevel.DEVICE,
"blacklistUnverifiedDevices" "blacklistUnverifiedDevices"
); );
cli.setGlobalBlacklistUnverifiedDevices(blacklistEnabled); cli.setGlobalBlacklistUnverifiedDevices(blacklistEnabled);
}
}, },
showScreen: function(screen, params) { showScreen: function(screen, params) {

View file

@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import Promise from "bluebird";
import SettingsHandler from "./SettingsHandler"; import SettingsHandler from "./SettingsHandler";
/** /**
@ -51,7 +52,8 @@ export default class LocalEchoWrapper extends SettingsHandler {
const cacheRoomId = roomId ? roomId : "UNDEFINED"; // avoid weird keys const cacheRoomId = roomId ? roomId : "UNDEFINED"; // avoid weird keys
bySetting[cacheRoomId] = newValue; bySetting[cacheRoomId] = newValue;
return this._handler.setValue(settingName, roomId, newValue).finally(() => { const handlerPromise = this._handler.setValue(settingName, roomId, newValue);
return Promise.resolve(handlerPromise).finally(() => {
delete bySetting[cacheRoomId]; delete bySetting[cacheRoomId];
}); });
} }

View file

@ -62,7 +62,6 @@ describe('MessagePanel', function() {
client.credentials = {userId: '@me:here'}; client.credentials = {userId: '@me:here'};
// HACK: We assume all settings want to be disabled // HACK: We assume all settings want to be disabled
// TODO: {Travis} Run the tests to verify this works
SettingsStore.getValue = sinon.stub().returns(false); SettingsStore.getValue = sinon.stub().returns(false);
}); });