Mercurial Hosting > lang
view src/delete_chat.js.luan @ 4:b1adec083e44
chat work
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 08 Jul 2025 22:15:41 -0600 |
parents | |
children | f5425a3c1898 |
line wrap: on
line source
local Luan = require "luan:Luan.luan" local error = Luan.error local Io = require "luan:Io.luan" local Http = require "luan:http/Http.luan" local User = require "site:/lib/User.luan" local current_user = User.current or error() local Chat = require "site:/lib/Chat.luan" local get_chat_by_id = Chat.get_by_id or error() return function() local chat = Http.request.parameters.chat or error() chat = get_chat_by_id(chat) or error() chat.user_id == current_user().id or error() chat.delete() Io.stdout = Http.response.text_writer() %> location = '/'; <% end