annotate src/delete_user.js.luan @ 54:1d724f187cff

minor fix
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 03 Mar 2025 21:19:12 -0700
parents e2b7f6393dab
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1 local Luan = require "luan:Luan.luan"
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2 local error = Luan.error
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
3 local Io = require "luan:Io.luan"
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
4 local Http = require "luan:http/Http.luan"
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5 local User = require "site:/lib/User.luan"
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6 local current_user = User.current or error()
17
7230c821c368 push fixes
Franklin Schmidt <fschmidt@gmail.com>
parents: 6
diff changeset
7 local Shared = require "site:/lib/Shared.luan"
7230c821c368 push fixes
Franklin Schmidt <fschmidt@gmail.com>
parents: 6
diff changeset
8 local http_push_to_users = Shared.http_push_to_users or error()
7230c821c368 push fixes
Franklin Schmidt <fschmidt@gmail.com>
parents: 6
diff changeset
9 local Logging = require "luan:logging/Logging.luan"
7230c821c368 push fixes
Franklin Schmidt <fschmidt@gmail.com>
parents: 6
diff changeset
10 local logger = Logging.logger "delete_user.js"
6
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
11
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
12
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
13 return function()
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
14 local user = current_user()
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
15 if user ~= nil then
33
e2b7f6393dab add online
Franklin Schmidt <fschmidt@gmail.com>
parents: 30
diff changeset
16 local user_ids = user.chatting_with_ids()
17
7230c821c368 push fixes
Franklin Schmidt <fschmidt@gmail.com>
parents: 6
diff changeset
17 local js = "getChats(null)"
6
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
18 user.delete()
17
7230c821c368 push fixes
Franklin Schmidt <fschmidt@gmail.com>
parents: 6
diff changeset
19 http_push_to_users( user_ids, js )
6
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
20 end
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
21 Io.stdout = Http.response.text_writer()
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
22 %>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
23 logout();
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
24 <%
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
25 end