remove duplicates from avatars list

This commit is contained in:
Brenden Bice 2019-04-05 14:31:54 -04:00
parent 80ba4f27c8
commit 7dea2d470e

View file

@ -12,7 +12,7 @@ import generateProfileLink from 'src/services/user_profile_link_generator/user_p
import fileType from 'src/services/file_type/file_type.service' import fileType from 'src/services/file_type/file_type.service'
import { highlightClass, highlightStyle } from '../../services/user_highlighter/user_highlighter.js' import { highlightClass, highlightStyle } from '../../services/user_highlighter/user_highlighter.js'
import { mentionMatchesUrl, extractTagFromUrl } from 'src/services/matcher/matcher.service.js' import { mentionMatchesUrl, extractTagFromUrl } from 'src/services/matcher/matcher.service.js'
import { filter, find, unescape } from 'lodash' import { filter, find, unescape, uniqBy } from 'lodash'
const Status = { const Status = {
name: 'Status', name: 'Status',
@ -260,10 +260,11 @@ const Status = {
return this.status.summary_html + '<br />' + this.status.statusnet_html return this.status.summary_html + '<br />' + this.status.statusnet_html
}, },
combinedFavsAndRepeatsAvatars () { combinedFavsAndRepeatsAvatars () {
return [].concat( const combinedAvatars = [].concat(
this.statusoid.favoritedBy ? this.statusoid.favoritedBy : [], this.statusoid.favoritedBy ? this.statusoid.favoritedBy : [],
this.statusoid.rebloggedBy ? this.statusoid.rebloggedBy : [] this.statusoid.rebloggedBy ? this.statusoid.rebloggedBy : []
) )
return uniqBy(combinedAvatars, 'id')
} }
}, },
components: { components: {