Mercurial Hosting > lang
comparison src/save_chat.js.luan @ 34:0fb3488a017d
show_text
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 04 Aug 2025 23:06:19 -0600 |
parents | d34d709a7a8e |
children | 2737eeedc1d5 |
comparison
equal
deleted
inserted
replaced
33:7d9462ea03e3 | 34:0fb3488a017d |
---|---|
8 local get_chat_by_id = Chat.get_by_id or error() | 8 local get_chat_by_id = Chat.get_by_id or error() |
9 local User = require "site:/lib/User.luan" | 9 local User = require "site:/lib/User.luan" |
10 local current_user = User.current or error() | 10 local current_user = User.current or error() |
11 local Db = require "site:/lib/Db.luan" | 11 local Db = require "site:/lib/Db.luan" |
12 local run_in_transaction = Db.run_in_transaction or error() | 12 local run_in_transaction = Db.run_in_transaction or error() |
13 local Logging = require "luan:logging/Logging.luan" | |
14 local logger = Logging.logger "save_chat.js" | |
13 | 15 |
14 | 16 |
15 return function() | 17 return function() |
16 local chat = Http.request.parameters.chat or error() | 18 local chat = Http.request.parameters.chat or error() |
17 local name = Http.request.parameters.name or error() | 19 local name = Http.request.parameters.name or error() |
18 local language_region = Http.request.parameters.language_region or error() | 20 local language_region = Http.request.parameters.language_region or error() |
19 local voice = Http.request.parameters.voice or error() | 21 local voice = Http.request.parameters.voice or error() |
22 local show_text = Http.request.parameters.show_text | |
20 run_in_transaction( function() | 23 run_in_transaction( function() |
21 chat = get_chat_by_id(chat) or error() | 24 chat = get_chat_by_id(chat) or error() |
22 chat.user_id == current_user().id or error() | 25 chat.user_id == current_user().id or error() |
23 chat.name = name | 26 chat.name = name |
24 chat.language_region = language_region | 27 chat.language_region = language_region |
25 chat.voice = voice | 28 chat.voice = voice |
29 chat.show_text = show_text ~= nil | |
26 chat.save() | 30 chat.save() |
27 end ) | 31 end ) |
28 Io.stdout = Http.response.text_writer() | 32 Io.stdout = Http.response.text_writer() |
29 %> | 33 %> |
30 setChat(<%= json_string(chat.info()) %>); | 34 setChat(<%= json_string(chat.info()) %>); |