Mercurial Hosting > chat
comparison src/active.js.luan @ 105:62d6725b4db0 default tip
logging
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 25 Jul 2025 14:39:13 -0600 |
parents | 3053a4fc10be |
children |
comparison
equal
deleted
inserted
replaced
104:46418395c860 | 105:62d6725b4db0 |
---|---|
5 local current_user = User.current or error() | 5 local current_user = User.current or error() |
6 local Notify = require "site:/lib/Notify.luan" | 6 local Notify = require "site:/lib/Notify.luan" |
7 local remove_notify = Notify.remove or error() | 7 local remove_notify = Notify.remove or error() |
8 local Chat = require "site:/lib/Chat.luan" | 8 local Chat = require "site:/lib/Chat.luan" |
9 local get_chat_by_id = Chat.get_by_id or error() | 9 local get_chat_by_id = Chat.get_by_id or error() |
10 local Logging = require "luan:logging/Logging.luan" | |
11 local logger = Logging.logger "active.js" | |
10 | 12 |
11 | 13 |
12 return function() | 14 return function() |
13 local spy = Http.request.cookies.spy ~= nil | 15 local spy = Http.request.cookies.spy ~= nil |
14 if spy then | 16 if spy then |
15 return | 17 return |
16 end | 18 end |
17 local user = current_user() or error() | 19 local user = current_user() |
20 if user == nil then | |
21 logger.warn("no user") | |
22 return | |
23 end | |
18 remove_notify(user) | 24 remove_notify(user) |
19 local chat = Http.request.parameters.chat | 25 local chat = Http.request.parameters.chat |
20 if chat ~= nil then | 26 if chat ~= nil then |
21 chat = get_chat_by_id(chat) or error() | 27 chat = get_chat_by_id(chat) or error() |
22 chat.read(user) | 28 chat.read(user) |