Mercurial Hosting > lang
annotate src/new_chat.red.luan @ 18:820136c5ee33
add new_chat.red
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 30 Jul 2025 15:11:24 -0600 |
parents | |
children | 0c17c233c45a |
rev | line source |
---|---|
18 | 1 local Luan = require "luan:Luan.luan" |
2 local error = Luan.error | |
3 local Http = require "luan:http/Http.luan" | |
4 local User = require "site:/lib/User.luan" | |
5 local current_user = User.current or error() | |
6 local Chat = require "site:/lib/Chat.luan" | |
7 | |
8 | |
9 return function() | |
10 local user = current_user() or error() | |
11 local chat = Chat.new{ | |
12 user_id = user.id | |
13 name = "whatever" | |
14 language = "jp" | |
15 } | |
16 chat.save() | |
17 Http.response.send_redirect("chat.html?chat="..chat.id) | |
18 end |