Mercurial Hosting > chat
comparison src/get_chat.js.luan @ 46:42b741a1d5c6
add username
| author | Franklin Schmidt <fschmidt@gmail.com> |
|---|---|
| date | Fri, 28 Feb 2025 19:25:12 -0700 |
| parents | 818697418dbe |
| children | 9298b04607ae |
comparison
equal
deleted
inserted
replaced
| 45:e138343b2c76 | 46:42b741a1d5c6 |
|---|---|
| 5 local json_string = Parsers.json_string or error() | 5 local json_string = Parsers.json_string or error() |
| 6 local Io = require "luan:Io.luan" | 6 local Io = require "luan:Io.luan" |
| 7 local Http = require "luan:http/Http.luan" | 7 local Http = require "luan:http/Http.luan" |
| 8 local User = require "site:/lib/User.luan" | 8 local User = require "site:/lib/User.luan" |
| 9 local current_user = User.current or error() | 9 local current_user = User.current or error() |
| 10 local get_user_by_id = User.get_by_id or error() | |
| 10 local Chat = require "site:/lib/Chat.luan" | 11 local Chat = require "site:/lib/Chat.luan" |
| 11 local get_chat_by_id = Chat.get_by_id or error() | 12 local get_chat_by_id = Chat.get_by_id or error() |
| 12 local Post = require "site:/lib/Post.luan" | 13 local Post = require "site:/lib/Post.luan" |
| 13 local post_search = Post.search or error() | 14 local post_search = Post.search or error() |
| 14 local Shared = require "site:/lib/Shared.luan" | 15 local Shared = require "site:/lib/Shared.luan" |
| 15 local post_html = Shared.post_html or error() | 16 local post_html = Shared.post_html or error() |
| 16 local chat_other_users_html = Shared.chat_other_users_html or error() | |
| 17 local Logging = require "luan:logging/Logging.luan" | 17 local Logging = require "luan:logging/Logging.luan" |
| 18 local logger = Logging.logger "get_chat.js" | 18 local logger = Logging.logger "get_chat.js" |
| 19 | 19 |
| 20 | 20 |
| 21 local function html() | 21 local function html() |
| 25 local posts = post_search( "post_chat_id:"..chat.id, "id" ) | 25 local posts = post_search( "post_chat_id:"..chat.id, "id" ) |
| 26 %> | 26 %> |
| 27 <div top> | 27 <div top> |
| 28 <h3> | 28 <h3> |
| 29 <img back onclick="back()" src="/images/arrow_back.svg"> | 29 <img back onclick="back()" src="/images/arrow_back.svg"> |
| 30 <span><% chat_other_users_html(chat,user,true) %></span> | 30 <span><% |
| 31 local user_id = chat.other_user_id(user.id) | |
| 32 local other_user = get_user_by_id(user_id) or error(user_id) | |
| 33 %><%= other_user.name_html() %><span online="<%= other_user.id %>"></span><% | |
| 34 local voice_url = other_user.voice_url | |
| 35 if voice_url ~= nil then | |
| 36 %> <a href="<%=voice_url%>" title="Call" target="voice"><img phone src="/images/call.svg"></a><% | |
| 37 end | |
| 38 %></span> | |
| 31 </h3> | 39 </h3> |
| 32 <button onclick='deleteChat()'>Delete</button> | 40 <button onclick='deleteChat()'>Delete</button> |
| 33 </div> | 41 </div> |
| 34 <div main> | 42 <div main> |
| 35 <% | 43 <% |
