Mercurial Hosting > chat
comparison src/lib/Notify.luan @ 104:46418395c860 default tip
add mute chat
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 14 Jul 2025 00:49:11 -0600 |
parents | 246a792adedf |
children |
comparison
equal
deleted
inserted
replaced
103:3ea9783cee39 | 104:46418395c860 |
---|---|
36 | 36 |
37 local function init() | 37 local function init() |
38 local users = {} | 38 local users = {} |
39 local fns = {} | 39 local fns = {} |
40 | 40 |
41 function fns.add(user_ids) | 41 function fns.add(user_ids,mute_ids) |
42 local now = time_now() | 42 local now = time_now() |
43 for _, user_id in ipairs(user_ids) do | 43 for _, user_id in ipairs(user_ids) do |
44 local user = get_user_by_id(user_id) | 44 local user = get_user_by_id(user_id) |
45 if users[user_id] == nil and user.notify_email ~= nil and (user.multi_notify or not user.was_notified) then | 45 if users[user_id] == nil \ |
46 and user.notify_email ~= nil \ | |
47 and not mute_ids[user_id] \ | |
48 and (user.multi_notify or not user.was_notified) \ | |
49 then | |
46 users[user_id] = now | 50 users[user_id] = now |
47 -- logger.info("add "..user_id) | 51 -- logger.info("add "..user_id) |
48 end | 52 end |
49 end | 53 end |
50 end | 54 end |
86 | 90 |
87 local glob = Thread.global_callable("notify",init) | 91 local glob = Thread.global_callable("notify",init) |
88 | 92 |
89 function Notify.add(chat) | 93 function Notify.add(chat) |
90 Thread.run(function() | 94 Thread.run(function() |
91 glob.add(chat.user_ids) | 95 glob.add(chat.user_ids,chat.mute_ids) |
92 end) | 96 end) |
93 end | 97 end |
94 | 98 |
95 function Notify.remove(user) | 99 function Notify.remove(user) |
96 Thread.run(function() | 100 Thread.run(function() |