Mercurial Hosting > lang
view src/delete_chat.js.luan @ 57:7c31604ce3fc
minor
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 17 Aug 2025 18:40:33 +0900 |
parents | 19901d6fb56f |
children |
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 = '/chats.html'; <% end