mirror of
https://notabug.org/scuti/pleroma-comments
synced 2025-01-24 20:21:56 +05:30
include opening post in comments
This commit is contained in:
parent
4d9bb430d2
commit
05ea67e03d
@ -127,12 +127,6 @@ function combine_tables(a,b)
|
|||||||
return a
|
return a
|
||||||
end
|
end
|
||||||
|
|
||||||
function get_opening_post(host, post_id)
|
|
||||||
local url = "https://" .. host .. "/api/v1/statuses" .. post_id
|
|
||||||
print(url)
|
|
||||||
local received = get(url)
|
|
||||||
end
|
|
||||||
|
|
||||||
function get_url_from_pandoc_str(pandoc_str)
|
function get_url_from_pandoc_str(pandoc_str)
|
||||||
local str = pandoc.utils.stringify(pandoc_str)
|
local str = pandoc.utils.stringify(pandoc_str)
|
||||||
-- 1 = protocol, 2 = host ...
|
-- 1 = protocol, 2 = host ...
|
||||||
@ -147,6 +141,12 @@ function get_url_from_pandoc_str(pandoc_str)
|
|||||||
return link, host, id
|
return link, host, id
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function get_status(host, post_id)
|
||||||
|
local url = "https://" .. host .. "/api/v1/statuses/" .. post_id
|
||||||
|
print(url)
|
||||||
|
return get(url)
|
||||||
|
end
|
||||||
|
|
||||||
function get_replies(host, id)
|
function get_replies(host, id)
|
||||||
local url = "https://" .. host .. "/api/v1/statuses/" .. id .. "/context"
|
local url = "https://" .. host .. "/api/v1/statuses/" .. id .. "/context"
|
||||||
print(url)
|
print(url)
|
||||||
@ -170,12 +170,10 @@ function Meta(meta)
|
|||||||
table.insert(hrefs,
|
table.insert(hrefs,
|
||||||
{link = link, id = id}
|
{link = link, id = id}
|
||||||
)
|
)
|
||||||
|
local op = get_status(host, id)
|
||||||
|
table.insert(all_replies, op)
|
||||||
local replies = get_replies(host, id)
|
local replies = get_replies(host, id)
|
||||||
if #all_replies == 0 then
|
combine_tables(all_replies, replies)
|
||||||
all_replies = replies
|
|
||||||
else
|
|
||||||
combine_tables(all_replies, replies)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
table.sort(all_replies,
|
table.sort(all_replies,
|
||||||
function(a, b)
|
function(a, b)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user