Mercurial Hosting > chat
comparison src/active.js.luan @ 110:d2637760cd00
better notification
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 15 Sep 2025 13:29:10 -0600 |
parents | 62d6725b4db0 |
children |
comparison
equal
deleted
inserted
replaced
109:b86bb25fb416 | 110:d2637760cd00 |
---|---|
2 local error = Luan.error | 2 local error = Luan.error |
3 local Http = require "luan:http/Http.luan" | 3 local Http = require "luan:http/Http.luan" |
4 local User = require "site:/lib/User.luan" | 4 local User = require "site:/lib/User.luan" |
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 notify_active = Notify.active 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" | 10 local Logging = require "luan:logging/Logging.luan" |
11 local logger = Logging.logger "active.js" | 11 local logger = Logging.logger "active.js" |
12 | 12 |
19 local user = current_user() | 19 local user = current_user() |
20 if user == nil then | 20 if user == nil then |
21 logger.warn("no user") | 21 logger.warn("no user") |
22 return | 22 return |
23 end | 23 end |
24 remove_notify(user) | 24 notify_active(user) |
25 local chat = Http.request.parameters.chat | 25 local chat = Http.request.parameters.chat |
26 if chat ~= nil then | 26 if chat ~= nil then |
27 chat = get_chat_by_id(chat) or error() | 27 chat = get_chat_by_id(chat) or error() |
28 chat.read(user) | 28 chat.read(user) |
29 end | 29 end |