Files
Signal-Desktop/js/keychange_listener.js
Scott Nonnenberg 43a44793c5 Remove jshint - move everything over to eslint
Also removed all hints of previous linters
2018-07-17 15:54:32 -07:00

33 lines
875 B
JavaScript

/* global Whisper, SignalProtocolStore, ConversationController, _ */
/* eslint-disable more/no-then */
// eslint-disable-next-line func-names
(function() {
'use strict';
window.Whisper = window.Whisper || {};
Whisper.KeyChangeListener = {
init(signalProtocolStore) {
if (!(signalProtocolStore instanceof SignalProtocolStore)) {
throw new Error('KeyChangeListener requires a SignalProtocolStore');
}
signalProtocolStore.on('keychange', id => {
ConversationController.getOrCreateAndWait(id, 'private').then(
conversation => {
conversation.addKeyChange(id);
ConversationController.getAllGroupsInvolvingId(id).then(groups => {
_.forEach(groups, group => {
group.addKeyChange(id);
});
});
}
);
});
},
};
})();