kopia lustrzana https://github.com/nextcloud/social
Ellipses actors' list when its big when displaying a notification
Signed-off-by: Cyrille Bollu <cyrpub@bollu.be>pull/625/head
rodzic
f80d9c6b4d
commit
30930e7a89
|
|
@ -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
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Ładowanie…
Reference in New Issue