Mercurial Hosting > lang
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 3:eee6d4f59811 | 4:b1adec083e44 |
|---|---|
| 1 local Luan = require "luan:Luan.luan" | |
| 2 local error = Luan.error | |
| 3 local Io = require "luan:Io.luan" | |
| 4 local Http = require "luan:http/Http.luan" | |
| 5 local User = require "site:/lib/User.luan" | |
| 6 local current_user = User.current or error() | |
| 7 local Chat = require "site:/lib/Chat.luan" | |
| 8 local get_chat_by_id = Chat.get_by_id or error() | |
| 9 | |
| 10 | |
| 11 return function() | |
| 12 local chat = Http.request.parameters.chat or error() | |
| 13 chat = get_chat_by_id(chat) or error() | |
| 14 chat.user_id == current_user().id or error() | |
| 15 chat.delete() | |
| 16 Io.stdout = Http.response.text_writer() | |
| 17 %> | |
| 18 location = '/'; | |
| 19 <% | |
| 20 end |
