fixed bug with 'true' showing up on page

This commit is contained in:
antares 2024-11-24 14:04:57 -08:00
parent 173e4f5947
commit 63fed806ac

View File

@ -3,6 +3,12 @@
-- local https = "wget" -- local https = "wget"
local json = require("cjson") local json = require("cjson")
function printTable(t)
for key, value in pairs(t) do
print(key, value)
end
end
function tokenizeString(inputString, delimiter) function tokenizeString(inputString, delimiter)
local tokens = {} local tokens = {}
for token in inputString:gmatch("[^" .. delimiter .. "]+") do for token in inputString:gmatch("[^" .. delimiter .. "]+") do
@ -43,6 +49,9 @@ function get_short_date(timestamp)
end end
function write_comments(pleroma_posts, instance) function write_comments(pleroma_posts, instance)
if #pleroma_posts == 0 then
return ""
end
local template = [[ local template = [[
<article class="pleroma-comment" id="pleroma-comment$i$"> <article class="pleroma-comment" id="pleroma-comment$i$">
<h3> <h3>
@ -128,6 +137,7 @@ function Meta(meta)
local c = write_comments(all_replies, "https://" .. host) local c = write_comments(all_replies, "https://" .. host)
meta["pleroma-comments"] = c meta["pleroma-comments"] = c
meta["pleroma-comments-count"] = #c meta["pleroma-comments-count"] = #c
meta["pleroma-has-comments"] = (#c > 0)
meta["pleroma"] = newelem meta["pleroma"] = newelem
return meta return meta
end end