Mercurial Hosting > chat
comparison src/chat.js.luan @ 7:41d35b72c774
chat page
| author | Franklin Schmidt <fschmidt@gmail.com> |
|---|---|
| date | Tue, 29 Oct 2024 22:11:40 -0600 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 6:e22a1ba4b2ed | 7:41d35b72c774 |
|---|---|
| 1 local Luan = require "luan:Luan.luan" | |
| 2 local error = Luan.error | |
| 3 local Parsers = require "luan:Parsers.luan" | |
| 4 local json_string = Parsers.json_string or error() | |
| 5 local Io = require "luan:Io.luan" | |
| 6 local Http = require "luan:http/Http.luan" | |
| 7 local User = require "site:/lib/User.luan" | |
| 8 local current_user = User.current or error() | |
| 9 local Chat = require "site:/lib/Chat.luan" | |
| 10 local get_chat_by_id = Chat.get_by_id or error() | |
| 11 | |
| 12 | |
| 13 local function html() | |
| 14 local user = current_user() or error() | |
| 15 local chat = Http.request.parameters.chat or error() | |
| 16 chat = get_chat_by_id(chat) or error() | |
| 17 %> | |
| 18 <p><%= chat.other_users_email(user) %></p> | |
| 19 <% | |
| 20 end | |
| 21 | |
| 22 return function() | |
| 23 Io.stdout = Http.response.text_writer() | |
| 24 %> | |
| 25 document.querySelector('div[posts]').innerHTML = <%=json_string(`html()`)%>; | |
| 26 <% | |
| 27 end |
