From 63fed806acf734c1ac4e69e309602f459756ac3a Mon Sep 17 00:00:00 2001 From: antares Date: Sun, 24 Nov 2024 14:04:57 -0800 Subject: [PATCH] fixed bug with 'true' showing up on page --- pleroma-comments.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pleroma-comments.lua b/pleroma-comments.lua index 5fa996e..2a4aba6 100644 --- a/pleroma-comments.lua +++ b/pleroma-comments.lua @@ -3,6 +3,12 @@ -- local https = "wget" local json = require("cjson") +function printTable(t) + for key, value in pairs(t) do + print(key, value) + end +end + function tokenizeString(inputString, delimiter) local tokens = {} for token in inputString:gmatch("[^" .. delimiter .. "]+") do @@ -43,6 +49,9 @@ function get_short_date(timestamp) end function write_comments(pleroma_posts, instance) + if #pleroma_posts == 0 then + return "" + end local template = [[

@@ -128,6 +137,7 @@ function Meta(meta) local c = write_comments(all_replies, "https://" .. host) meta["pleroma-comments"] = c meta["pleroma-comments-count"] = #c + meta["pleroma-has-comments"] = (#c > 0) meta["pleroma"] = newelem return meta end