Mercurial Hosting > chat
diff src/delete_chat.js.luan @ 17:7230c821c368
push fixes
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 04 Nov 2024 14:44:35 -0700 |
parents | 82b55186a4a0 |
children | 323ddacc1593 |
line wrap: on
line diff
--- a/src/delete_chat.js.luan Sun Nov 03 21:22:06 2024 -0700 +++ b/src/delete_chat.js.luan Mon Nov 04 14:44:35 2024 -0700 @@ -7,13 +7,17 @@ local get_chat_by_id = Chat.get_by_id or error() local Shared = require "site:/lib/Shared.luan" local http_push_to_users = Shared.http_push_to_users or error() +local Utils = require "site:/lib/Utils.luan" +local is_in_list = Utils.is_in_list or error() return function() local chat = Http.request.parameters.chat or error() chat = get_chat_by_id(chat) or error() + local user_ids = chat.user_ids local user = current_user() or error() + is_in_list( user.id, user_ids ) or error() chat.delete() local js = "getChats(null)" - http_push_to_users( chat.user_ids, js ) + http_push_to_users( user_ids, js ) end