chore: return null and skip rendering webmentions container + extra border if there are no mentions

This commit is contained in:
Cory Dransfeldt 2024-01-01 16:49:17 -08:00
parent 12b42dc05d
commit ccd2fbf058
No known key found for this signature in database
4 changed files with 15 additions and 5 deletions

View file

@ -56,6 +56,8 @@ export default {
return tagMap[url] || ''
},
webmentionsByUrl: (webmentions, url) => {
if (!webmentions) return null;
const allowedTypes = ['mention-of', 'in-reply-to', 'like-of', 'repost-of']
const data = {
'like-of': [],
@ -103,6 +105,13 @@ export default {
a.published > b.published ? 1 : b.published > a.published ? -1 : 0
)
// delete empty keys
Object.keys(data).forEach((key) => {
if (data[key].length === 0) delete data[key]
});
if (!Object.keys(data).length) return null;
return data
},