16
|
1 local Luan = require "luan:Luan.luan"
|
|
2 local error = Luan.error
|
|
3 local Io = require "luan:Io.luan"
|
42
|
4 local output_of = Io.output_of or error()
|
16
|
5 local Http = require "luan:http/Http.luan"
|
|
6 local Post = require "site:/lib/Post.luan"
|
42
|
7 local Shared = require "site:/lib/Shared.luan"
|
|
8 local base_url = Shared.base_url or error()
|
16
|
9
|
|
10
|
|
11 return function()
|
|
12 local post = Http.request.parameters.post or error()
|
42
|
13 post = Post.get_by_id(post) or error()
|
|
14 local root_id = post.root_id
|
|
15 post.delete()
|
|
16 local js = output_of(function()
|
16
|
17 %>
|
42
|
18 deleted( '<%=post.id%>', <%=Post.thread_size(root_id)%> );
|
16
|
19 <%
|
42
|
20 end)
|
|
21 local url = base_url().."/thread.html?root="..root_id
|
|
22 Http.push(url,js)
|
16
|
23 end
|