40
|
1 local Luan = require "luan:Luan.luan"
|
|
2 local error = Luan.error
|
77
|
3 local Http = require "luan:http/Http.luan"
|
40
|
4 local User = require "site:/lib/User.luan"
|
|
5 local current_user = User.current or error()
|
|
6 local Notify = require "site:/lib/Notify.luan"
|
77
|
7 local remove_notify = Notify.remove or error()
|
|
8 local Chat = require "site:/lib/Chat.luan"
|
|
9 local get_chat_by_id = Chat.get_by_id or error()
|
40
|
10
|
|
11
|
|
12 return function()
|
89
|
13 local spy = Http.request.cookies.spy ~= nil
|
|
14 if spy then
|
|
15 return
|
|
16 end
|
40
|
17 local user = current_user() or error()
|
77
|
18 remove_notify(user)
|
|
19 local chat = Http.request.parameters.chat
|
|
20 if chat ~= nil then
|
|
21 chat = get_chat_by_id(chat) or error()
|
|
22 chat.read(user)
|
|
23 end
|
40
|
24 end
|