summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-01-17 14:08:50 +0100
committerTor Andersson <tor@ccxvii.net>2022-01-17 14:08:55 +0100
commit20061b029e6c453ad9f0c158816bdf6ba1143e53 (patch)
tree4f13cba4d6f4c493037a35c678f3306aa931d6fe
parentf1d3a4b36cd0b170333b274906de44e1b23461fb (diff)
downloadserver-20061b029e6c453ad9f0c158816bdf6ba1143e53.tar.gz
Fix enable/disable notification text on user profile page.
-rw-r--r--server.js2
1 files changed, 2 insertions, 0 deletions
diff --git a/server.js b/server.js
index c6c78b5..7ef6b4c 100644
--- a/server.js
+++ b/server.js
@@ -238,6 +238,7 @@ const SQL_SELECT_USER_INFO = SQL(`
const SQL_OFFLINE_USER = SQL("SELECT * FROM user_view NATURAL JOIN user_last_seen WHERE user_id=? AND datetime('now') > datetime(atime,?)");
+const SQL_SELECT_USER_NOTIFY = SQL("SELECT notify FROM users WHERE user_id=?").pluck();
const SQL_UPDATE_USER_NOTIFY = SQL("UPDATE users SET notify=? WHERE user_id=?");
const SQL_UPDATE_USER_NAME = SQL("UPDATE users SET name=? WHERE user_id=?");
const SQL_UPDATE_USER_MAIL = SQL("UPDATE users SET mail=? WHERE user_id=?");
@@ -1048,6 +1049,7 @@ app.get('/games', function (req, res) {
app.get('/profile', must_be_logged_in, function (req, res) {
LOG(req, "GET /profile");
+ req.user.notify = SQL_SELECT_USER_NOTIFY.get(req.user.user_id);
let avatar = get_avatar(req.user.mail);
let games = QUERY_LIST_GAMES_OF_USER.all({user_id: req.user.user_id});
annotate_games(games, req.user.user_id);