view src/active.js.luan @ 93:d0566cc4a2ac default tip

uploa fix
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 03 Apr 2025 19:47:48 -0600
parents 3053a4fc10be
children
line wrap: on
line source

local Luan = require "luan:Luan.luan"
local error = Luan.error
local Http = require "luan:http/Http.luan"
local User = require "site:/lib/User.luan"
local current_user = User.current or error()
local Notify = require "site:/lib/Notify.luan"
local remove_notify = Notify.remove or error()
local Chat = require "site:/lib/Chat.luan"
local get_chat_by_id = Chat.get_by_id or error()


return function()
	local spy = Http.request.cookies.spy ~= nil
	if spy then
		return
	end
	local user = current_user() or error()
	remove_notify(user)
	local chat = Http.request.parameters.chat
	if chat ~= nil then
		chat = get_chat_by_id(chat) or error()
		chat.read(user)
	end
end