From 01f9499ee3d5653fceebef47f826895bf4016fee Mon Sep 17 00:00:00 2001 From: joaomgcd Date: Fri, 7 Aug 2020 16:51:31 +0100 Subject: [PATCH] Fixed stored notifications always showing at startup --- .gitignore | 3 ++- server/servernotification.js | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 12db6d0..1891dfc 100644 --- a/.gitignore +++ b/.gitignore @@ -27,4 +27,5 @@ dist/win-unpacked .DS_Store dist/squirrel-windows/com.joaomgcd.join-**full.nupkg dist/squirrel-windows/RELEASES -**.nupkg \ No newline at end of file +**.nupkg +*.bak \ No newline at end of file diff --git a/server/servernotification.js b/server/servernotification.js index 6460bac..b4c2eef 100644 --- a/server/servernotification.js +++ b/server/servernotification.js @@ -236,8 +236,11 @@ class WindowNotification{ const crypto = require("crypto"); this.options.id = crypto.randomBytes(16).toString("hex"); } - this.timeCreated = new Date().getTime(); - this.timeoutTime = this.timeCreated + this.options.timeout; + this.timeCreated = options.timeCreated || new Date().getTime(); + this.timeoutTime = options.timeoutTime || (this.timeCreated + this.options.timeout); + + this.options.timeCreated = this.timeCreated; + this.options.timeoutTime = this.timeoutTime; } set hidden(value){ this.options.hidden = value;