Mercurial Hosting > chat
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 54:1d724f187cff | 55:d21ae4920aac |
|---|---|
| 41 | 41 |
| 42 function chat.delete() | 42 function chat.delete() |
| 43 run_in_transaction( function() | 43 run_in_transaction( function() |
| 44 local id = chat.id | 44 local id = chat.id |
| 45 Db.delete("post_chat_id:"..id) | 45 Db.delete("post_chat_id:"..id) |
| 46 Db.delete("chatuser_chat_id:"..id) | |
| 46 Db.delete("id:"..id) | 47 Db.delete("id:"..id) |
| 47 end ) | 48 end ) |
| 48 end | 49 end |
| 49 | 50 |
| 50 function chat.http_push(message) | 51 function chat.http_push(message) |
| 75 run_in_transaction( function() | 76 run_in_transaction( function() |
| 76 local chatuser_id = get_chatuser_id(user) | 77 local chatuser_id = get_chatuser_id(user) |
| 77 local doc = Db.get_document("chatuser_id:"..chatuser_id) or { | 78 local doc = Db.get_document("chatuser_id:"..chatuser_id) or { |
| 78 type = "chatuser" | 79 type = "chatuser" |
| 79 chatuser_id = chatuser_id | 80 chatuser_id = chatuser_id |
| 81 chatuser_chat_id = chat.id or error() | |
| 80 } | 82 } |
| 81 doc.read_date = time_now() | 83 doc.read_date = time_now() |
| 82 Db.save(doc) | 84 Db.save(doc) |
| 83 end ) | 85 end ) |
| 84 end | 86 end |
