Ellipses actors' list when its big when displaying a notification

Signed-off-by: Cyrille Bollu <cyrpub@bollu.be>
pull/625/head
Cyrille Bollu 2019-09-09 14:56:07 +02:00
rodzic f80d9c6b4d
commit 30930e7a89
1 zmienionych plików z 15 dodań i 2 usunięć

Wyświetl plik

@ -62,20 +62,33 @@ export default {
return t('social', 'boosted') return t('social', 'boosted')
}, },
actionSummary() { actionSummary() {
let summary = this.item.summary let summary = this.item.summary
for (var key in this.item.details) { for (var key in this.item.details) {
let keyword = '{' + key + '}' let keyword = '{' + key + '}'
if (typeof this.item.details[key] !== 'string' && this.item.details[key].length > 1) { if (typeof this.item.details[key] !== 'string' && this.item.details[key].length > 1) {
let concatination = '' let concatination = ''
for (var stringkey in this.item.details[key]) { for (var stringKey in this.item.details[key]) {
concatination += this.item.details[key][stringkey] + ', '
if (this.item.details[key].length > 3 && stringKey === 3) {
// ellipses the actors' list to 3 actors when it's big
concatination += 'and ' + (this.item.details[key].length - 3).toString() + ' other(s), '
break
} else {
concatination += this.item.details[key][stringKey] + ', '
}
} }
concatination = concatination.substring(0, concatination.length - 2) concatination = concatination.substring(0, concatination.length - 2)
summary = summary.replace(keyword, concatination) summary = summary.replace(keyword, concatination)
} else { } else {
summary = summary.replace(keyword, this.item.details[key]) summary = summary.replace(keyword, this.item.details[key])
} }
} }
return summary return summary
} }
}, },