Mercurial Hosting > chat
comparison src/delete_chat.js.luan @ 16:82b55186a4a0
fix delete_chat
| author | Franklin Schmidt <fschmidt@gmail.com> |
|---|---|
| date | Sun, 03 Nov 2024 21:22:06 -0700 |
| parents | 9f45d32670ae |
| children | 7230c821c368 |
comparison
equal
deleted
inserted
replaced
| 15:8b8905f63d80 | 16:82b55186a4a0 |
|---|---|
| 3 local Http = require "luan:http/Http.luan" | 3 local Http = require "luan:http/Http.luan" |
| 4 local User = require "site:/lib/User.luan" | 4 local User = require "site:/lib/User.luan" |
| 5 local current_user = User.current or error() | 5 local current_user = User.current or error() |
| 6 local Chat = require "site:/lib/Chat.luan" | 6 local Chat = require "site:/lib/Chat.luan" |
| 7 local get_chat_by_id = Chat.get_by_id or error() | 7 local get_chat_by_id = Chat.get_by_id or error() |
| 8 local Shared = require "site:/lib/Shared.luan" | |
| 9 local http_push_to_users = Shared.http_push_to_users or error() | |
| 8 | 10 |
| 9 | 11 |
| 10 return function() | 12 return function() |
| 11 local chat = Http.request.parameters.chat or error() | 13 local chat = Http.request.parameters.chat or error() |
| 12 chat = get_chat_by_id(chat) or error() | 14 chat = get_chat_by_id(chat) or error() |
| 13 local user = current_user() or error() | 15 local user = current_user() or error() |
| 14 chat.delete() | 16 chat.delete() |
| 15 chat.http_push("location = '/chat.html'") | 17 local js = "getChats(null)" |
| 18 http_push_to_users( chat.user_ids, js ) | |
| 16 end | 19 end |
