diff src/lib/Shared.luan @ 59:8270106644db

add chat.luan
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 04 Mar 2025 08:22:45 -0700
parents 9298b04607ae
children e229f4aacde0
line wrap: on
line diff
--- a/src/lib/Shared.luan	Tue Mar 04 07:38:43 2025 -0700
+++ b/src/lib/Shared.luan	Tue Mar 04 08:22:45 2025 -0700
@@ -7,8 +7,6 @@
 local Time = require "luan:Time.luan"
 local Thread = require "luan:Thread.luan"
 local thread_run = Thread.run or error()
-local Parsers = require "luan:Parsers.luan"
-local json_string = Parsers.json_string or error()
 local Html = require "luan:Html.luan"
 local html_encode = Html.encode or error()
 local Http = require "luan:http/Http.luan"
@@ -145,11 +143,12 @@
 	local user = current_user() or error()
 	local chats = chat_search( "chat_user_ids:"..user.id, "chat_updated desc" )
 	for _, chat in ipairs(chats) do
+		local chat_id = chat.id
 		local user_id = chat.other_user_id(user.id)
 		local other_user = get_user_by_id(user_id) or error()
 		local unread = chat.unread(user)
 %>
-		<div chat="<%=chat.id%>" onclick='selectChat(this,<%=json_string(other_user.email)%>)'>
+		<div chat="<%=chat_id%>" onclick="selectChat('<%=chat_id%>')">
 			<%= other_user.name_html() %>
 			<span online="<%= other_user.id %>"></span>
 			<span unread="<%=unread%>"><%=unread%></span>