Experimental news notification system + fix Eightpieces variant
[vchess.git] / client / src / store.js
index 8fe46b9..792d2a5 100644 (file)
@@ -31,7 +31,6 @@ export const store = {
         return;
       }
       this.state.variants = json.variantArray
-        .filter(v => v.name != "Eightpieces") //TODO: not ready yet
         .sort((v1,v2) => v1.name.localeCompare(v2.name));
     });
     let mysid = localStorage.getItem("mysid");
@@ -46,6 +45,7 @@ export const store = {
       name: localStorage.getItem("myname") || "", //"" for "anonymous"
       email: "", //unknown yet
       notify: false, //email notifications
+      newsRead: localStorage.getItem("newsRead") || 0,
       sid: mysid
     };
     // Slow verification through the server:
@@ -78,6 +78,8 @@ export const store = {
         localStorage.removeItem("myname");
       this.state.user.email = json.email;
       this.state.user.notify = json.notify;
+      if (!!json.newsRead && json.newsRead > this.state.user.newsRead)
+        this.state.user.newsRead = json.newsRead;
     });
     // Settings initialized with values from localStorage
     const getItemDefaultTrue = (item) => {