From c13b2df6c504ca0985c1b5976845f14f8f97862b Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Wed, 16 Oct 2019 18:09:19 -0700 Subject: [PATCH] fix: fix duplicate accounts in replies in Pleroma (#1592) fixes #1591 --- src/routes/_actions/compose.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/routes/_actions/compose.js b/src/routes/_actions/compose.js index 0daf5c66..80afa882 100644 --- a/src/routes/_actions/compose.js +++ b/src/routes/_actions/compose.js @@ -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('')