chore: return null and skip rendering webmentions container + extra border if there are no mentions
This commit is contained in:
parent
12b42dc05d
commit
ccd2fbf058
4 changed files with 15 additions and 5 deletions
|
@ -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
|
||||
},
|
||||
|
||||
|
|
Reference in a new issue