added null checks to new messages listener
This commit is contained in:
parent
8a63379db7
commit
0cbf904f58
@ -125,7 +125,7 @@ export class UserView implements Observer<ActiveUserViewModel> {
|
|||||||
// this._chatModel.getMessages(userName, vm.passphrase, null, "new");
|
// this._chatModel.getMessages(userName, vm.passphrase, null, "new");
|
||||||
el.className += " active";
|
el.className += " active";
|
||||||
log.debug("loop", this._newMessagesLoop)
|
log.debug("loop", this._newMessagesLoop)
|
||||||
if (vm.unlocked) {
|
if (vm.unlocked && vm.lastMessageTime != null) {
|
||||||
this._newMessagesLoop = setInterval(this._chatModel.getMessages.bind(this._chatModel,
|
this._newMessagesLoop = setInterval(this._chatModel.getMessages.bind(this._chatModel,
|
||||||
vm, "update"), 10_000);
|
vm, "update"), 10_000);
|
||||||
}
|
}
|
||||||
@ -135,8 +135,10 @@ export class UserView implements Observer<ActiveUserViewModel> {
|
|||||||
// vms.filter(v => v.userName == vm.userName).map(v => v.userName = vm.userName)
|
// vms.filter(v => v.userName == vm.userName).map(v => v.userName = vm.userName)
|
||||||
log.debug(vms)
|
log.debug(vms)
|
||||||
|
|
||||||
|
if (vm.lastMessageTime != null) {
|
||||||
this._newMessagesLoop = setInterval(this._chatModel.getMessages.bind(this._chatModel,
|
this._newMessagesLoop = setInterval(this._chatModel.getMessages.bind(this._chatModel,
|
||||||
vm, "update"), 10_000);
|
vm, "update"), 10_000);
|
||||||
|
}
|
||||||
this._model.notify();
|
this._model.notify();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user