fix: fix duplicate accounts in replies in Pleroma (#1592)

fixes #1591
This commit is contained in:
Nolan Lawson 2019-10-16 18:09:19 -07:00 committed by GitHub
parent 107ad3727b
commit c13b2df6c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -5,14 +5,17 @@ import { addStatusOrNotification } from './addStatusOrNotification'
import { database } from '../_database/database'
import { emit } from '../_utils/eventBus'
import { putMediaMetadata } from '../_api/media'
import uniqBy from 'lodash-es/uniqBy'
export async function insertHandleForReply (statusId) {
const { currentInstance } = store.get()
const status = await database.getStatus(currentInstance, statusId)
const { currentVerifyCredentials } = store.get()
const originalStatus = status.reblog || status
const accounts = [originalStatus.account].concat(originalStatus.mentions || [])
let accounts = [originalStatus.account].concat(originalStatus.mentions || [])
.filter(account => account.id !== currentVerifyCredentials.id)
// Pleroma includes account in mentions as well, so make uniq https://github.com/nolanlawson/pinafore/issues/1591
accounts = uniqBy(accounts, _ => _.id)
if (!store.getComposeData(statusId, 'text') && accounts.length) {
store.setComposeData(statusId, {
text: accounts.map(account => `@${account.acct} `).join('')