Switch to vue-at for comment mentions

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2020-01-29 18:01:07 +01:00
parent cfec900763
commit 548c9a78ff
6 changed files with 119 additions and 190 deletions

View File

@@ -40,6 +40,11 @@ const parseXml = (xml) => {
}
const commentToObject = (tag) => {
let mentions = tag['d:prop']['oc:mentions']['oc:mention'] ?? []
if (mentions && !Array.isArray(mentions)) {
mentions = [mentions]
}
return {
cardId: tag['d:prop']['oc:objectId']['#text'],
id: tag['d:prop']['oc:id']['#text'],
@@ -47,6 +52,13 @@ const commentToObject = (tag) => {
actorDisplayName: tag['d:prop']['oc:actorDisplayName']['#text'],
creationDateTime: tag['d:prop']['oc:creationDateTime']['#text'],
message: tag['d:prop']['oc:message']['#text'],
mentions: mentions.map((mention) => {
return {
mentionType: mention['oc:mentionType']['#text'],
mentionId: mention['oc:mentionId']['#text'],
mentionDisplayName: mention['oc:mentionDisplayName']['#text'],
}
}),
}
}