Mercurial Hosting > chat
comparison src/lib/Shared.luan @ 53:9298b04607ae
add unread
| author | Franklin Schmidt <fschmidt@gmail.com> |
|---|---|
| date | Mon, 03 Mar 2025 19:39:30 -0700 |
| parents | 38c209714df9 |
| children | 8270106644db |
comparison
equal
deleted
inserted
replaced
| 52:c3fabb21b6c4 | 53:9298b04607ae |
|---|---|
| 145 local user = current_user() or error() | 145 local user = current_user() or error() |
| 146 local chats = chat_search( "chat_user_ids:"..user.id, "chat_updated desc" ) | 146 local chats = chat_search( "chat_user_ids:"..user.id, "chat_updated desc" ) |
| 147 for _, chat in ipairs(chats) do | 147 for _, chat in ipairs(chats) do |
| 148 local user_id = chat.other_user_id(user.id) | 148 local user_id = chat.other_user_id(user.id) |
| 149 local other_user = get_user_by_id(user_id) or error() | 149 local other_user = get_user_by_id(user_id) or error() |
| 150 local unread = chat.unread(user) | |
| 150 %> | 151 %> |
| 151 <div chat="<%=chat.id%>" onclick='selectChat(this,<%=json_string(other_user.email)%>)'><% | 152 <div chat="<%=chat.id%>" onclick='selectChat(this,<%=json_string(other_user.email)%>)'> |
| 152 %><%= other_user.name_html() %><span online="<%= other_user.id %>"></span><% | 153 <%= other_user.name_html() %> |
| 153 %></div> | 154 <span online="<%= other_user.id %>"></span> |
| 155 <span unread="<%=unread%>"><%=unread%></span> | |
| 156 </div> | |
| 154 <% | 157 <% |
| 155 end | 158 end |
| 156 end | 159 end |
| 157 | 160 |
| 158 function Shared.http_push_to_users(user_ids,message) | 161 function Shared.http_push_to_users(user_ids,message) |
