diff src/get_chat.js.luan @ 83:a47036fd0158

group chat
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 11 Mar 2025 13:56:59 -0600
parents b5a316575e64
children 3053a4fc10be
line wrap: on
line diff
--- a/src/get_chat.js.luan	Mon Mar 10 22:42:46 2025 -0600
+++ b/src/get_chat.js.luan	Tue Mar 11 13:56:59 2025 -0600
@@ -18,6 +18,7 @@
 local post_search = Post.search or error()
 local Shared = require "site:/lib/Shared.luan"
 local post_html = Shared.post_html or error()
+local group_name = Shared.group_name or error()
 local Logging = require "luan:logging/Logging.luan"
 local logger = Logging.logger "get_chat.js"
 
@@ -29,20 +30,33 @@
 	<div top>
 		<h3>
 			<img back onclick="back()" src="/images/arrow_back.svg">
-			<span><%
-				local user_id = chat.other_user_id(user.id)
-				local other_user = get_user_by_id(user_id) or error(user_id)
-				%><%= other_user.name_html() %><span online="<%= other_user.id %>"></span><%
-				local voice_url = other_user.voice_url
-				if voice_url ~= nil then
-					%> <a href="<%=voice_url%>" title="Call" target="voice"><img phone src="/images/call.svg"></a><%
-				end
-			%></span>
+			<span>
+<%
+	local user_ids = chat.other_user_ids(user.id)
+	if #user_ids > 1 then
+%>
+				<%= group_name(user_ids) %>
+<%
+	else
+		local other_user = get_user_by_id(user_ids[1]) or error()
+%>
+				<%= other_user.name_html() %><span online="<%= other_user.id %>"></span>
+<%
+		local voice_url = other_user.voice_url
+		if voice_url ~= nil then
+%>
+				<a href="<%=voice_url%>" title="Call" target="voice"><img phone src="/images/call.svg"></a>
+<%
+		end
+	end
+%>
+			</span>
 		</h3>
 		<span pulldown>
 			<img onclick="clickMenu(this)" src="/images/menu.svg">
 			<div>
 				<span onclick="openPeople()">People in Chat</span>
+				<span onclick="openAddToChat()">Add Someone to Chat</span>
 				<span onclick="deleteChat()">Delete Chat</span>
 			</div>
 		</span>