diff src/lib/Chat.luan @ 55:d21ae4920aac

minor fix
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 03 Mar 2025 21:42:38 -0700
parents 9298b04607ae
children c420f39eb474
line wrap: on
line diff
--- a/src/lib/Chat.luan	Mon Mar 03 21:19:12 2025 -0700
+++ b/src/lib/Chat.luan	Mon Mar 03 21:42:38 2025 -0700
@@ -43,6 +43,7 @@
 		run_in_transaction( function()
 			local id = chat.id
 			Db.delete("post_chat_id:"..id)
+			Db.delete("chatuser_chat_id:"..id)
 			Db.delete("id:"..id)
 		end )
 	end
@@ -77,6 +78,7 @@
 			local doc = Db.get_document("chatuser_id:"..chatuser_id) or {
 				type = "chatuser"
 				chatuser_id = chatuser_id
+				chatuser_chat_id = chat.id or error()
 			}
 			doc.read_date = time_now()
 			Db.save(doc)