Mercurial Hosting > lang
comparison src/save_chat.js.luan @ 52:27758f3b2d69
add hide_ruby
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sat, 16 Aug 2025 09:56:10 +0900 |
parents | cc20eebaa74a |
children |
comparison
equal
deleted
inserted
replaced
51:4581a20b8124 | 52:27758f3b2d69 |
---|---|
13 local Logging = require "luan:logging/Logging.luan" | 13 local Logging = require "luan:logging/Logging.luan" |
14 local logger = Logging.logger "save_chat.js" | 14 local logger = Logging.logger "save_chat.js" |
15 | 15 |
16 | 16 |
17 return function() | 17 return function() |
18 local chat = Http.request.parameters.chat or error() | 18 local parameters = Http.request.parameters |
19 local name = Http.request.parameters.name or error() | 19 local chat = parameters.chat or error() |
20 local voice = Http.request.parameters.voice or error() | |
21 local show_text = Http.request.parameters.show_text | |
22 local autoplay = Http.request.parameters.autoplay | |
23 local is_private = Http.request.parameters.is_private | |
24 run_in_transaction( function() | 20 run_in_transaction( function() |
25 chat = get_chat_by_id(chat) or error() | 21 chat = get_chat_by_id(chat) or error() |
26 chat.user_id == current_user().id or error() | 22 chat.user_id == current_user().id or error() |
27 chat.name = name | 23 chat.name = parameters.name or error() |
28 chat.voice = voice | 24 chat.voice = parameters.voice or error() |
29 chat.show_text = show_text ~= nil | 25 chat.show_text = parameters.show_text or error() |
30 chat.autoplay = autoplay ~= nil | 26 chat.autoplay = parameters.autoplay ~= nil |
31 chat.is_private = is_private ~= nil | 27 chat.is_private = parameters.is_private ~= nil |
32 chat.save() | 28 chat.save() |
33 end ) | 29 end ) |
34 Io.stdout = Http.response.text_writer() | 30 Io.stdout = Http.response.text_writer() |
35 %> | 31 %> |
36 setChat(<%= json_string(chat.info()) %>); | 32 setChat(<%= json_string(chat.info()) %>); |