Mercurial Hosting > chat
comparison src/delete_chat.js.luan @ 12:9f45d32670ae
server push
| author | Franklin Schmidt <fschmidt@gmail.com> |
|---|---|
| date | Thu, 31 Oct 2024 21:40:57 -0600 |
| parents | 563a5358f2ee |
| children | 82b55186a4a0 |
comparison
equal
deleted
inserted
replaced
| 11:563a5358f2ee | 12:9f45d32670ae |
|---|---|
| 1 local Luan = require "luan:Luan.luan" | 1 local Luan = require "luan:Luan.luan" |
| 2 local error = Luan.error | 2 local error = Luan.error |
| 3 local Io = require "luan:Io.luan" | |
| 4 local Http = require "luan:http/Http.luan" | 3 local Http = require "luan:http/Http.luan" |
| 5 local User = require "site:/lib/User.luan" | 4 local User = require "site:/lib/User.luan" |
| 6 local current_user = User.current or error() | 5 local current_user = User.current or error() |
| 7 local Chat = require "site:/lib/Chat.luan" | 6 local Chat = require "site:/lib/Chat.luan" |
| 8 local get_chat_by_id = Chat.get_by_id or error() | 7 local get_chat_by_id = Chat.get_by_id or error() |
| 11 return function() | 10 return function() |
| 12 local chat = Http.request.parameters.chat or error() | 11 local chat = Http.request.parameters.chat or error() |
| 13 chat = get_chat_by_id(chat) or error() | 12 chat = get_chat_by_id(chat) or error() |
| 14 local user = current_user() or error() | 13 local user = current_user() or error() |
| 15 chat.delete() | 14 chat.delete() |
| 16 Io.stdout = Http.response.text_writer() | 15 chat.http_push("location = '/chat.html'") |
| 17 %> | |
| 18 location = '/chat.html'; | |
| 19 <% | |
| 20 end | 16 end |
