comparison src/lib/Shared.luan @ 16:82b55186a4a0

fix delete_chat
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 03 Nov 2024 21:22:06 -0700
parents 8b8905f63d80
children 435f474f07c7
comparison
equal deleted inserted replaced
15:8b8905f63d80 16:82b55186a4a0
7 local Time = require "luan:Time.luan" 7 local Time = require "luan:Time.luan"
8 local Thread = require "luan:Thread.luan" 8 local Thread = require "luan:Thread.luan"
9 local thread_run = Thread.run or error() 9 local thread_run = Thread.run or error()
10 local Html = require "luan:Html.luan" 10 local Html = require "luan:Html.luan"
11 local html_encode = Html.encode or error() 11 local html_encode = Html.encode or error()
12 local Http = require "luan:http/Http.luan"
12 local Mail = require "luan:mail/Mail.luan" 13 local Mail = require "luan:mail/Mail.luan"
13 local User = require "site:/lib/User.luan" 14 local User = require "site:/lib/User.luan"
14 local current_user = User.current or error() 15 local current_user = User.current or error()
15 local get_user_by_id = User.get_by_id or error() 16 local get_user_by_id = User.get_by_id or error()
16 local Chat = require "site:/lib/Chat.luan" 17 local Chat = require "site:/lib/Chat.luan"
17 local chat_search = Chat.search or error() 18 local chat_search = Chat.search or error()
19 local Utils = require "site:/lib/Utils.luan"
20 local base_url = Utils.base_url or error()
18 21
19 22
20 local Shared = {} 23 local Shared = {}
21 24
22 local started = Time.now() 25 local started = Time.now()
110 <div chat="<%=chat.id%>" onclick="selectChat(this)"><%= chat.other_users_email(user) %></div> 113 <div chat="<%=chat.id%>" onclick="selectChat(this)"><%= chat.other_users_email(user) %></div>
111 <% 114 <%
112 end 115 end
113 end 116 end
114 117
118 function Shared.http_push_to_users(user_ids,message)
119 local base = base_url().."/user/"
120 for _, user_id in ipairs(user_ids) do
121 local url = base..user_id
122 Http.push(url,message)
123 end
124 end
125
115 return Shared 126 return Shared