view src/delete_user.js.luan @ 49:080eb027d93d

minor
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 28 Feb 2025 20:27:34 -0700
parents e2b7f6393dab
children
line wrap: on
line source

local Luan = require "luan:Luan.luan"
local error = Luan.error
local Io = require "luan:Io.luan"
local Http = require "luan:http/Http.luan"
local User = require "site:/lib/User.luan"
local current_user = User.current or error()
local Shared = require "site:/lib/Shared.luan"
local http_push_to_users = Shared.http_push_to_users or error()
local Logging = require "luan:logging/Logging.luan"
local logger = Logging.logger "delete_user.js"


return function()
	local user = current_user()
	if user ~= nil then
		local user_ids = user.chatting_with_ids()
		local js = "getChats(null)"
		user.delete()
		http_push_to_users( user_ids, js )
	end
	Io.stdout = Http.response.text_writer()
%>
	logout();
<%
end