From a56f68d9ba55a5986d2f0d3e865dff7f3115aeab Mon Sep 17 00:00:00 2001 From: Daniel Kesselberg Date: Tue, 31 Aug 2021 17:42:11 +0200 Subject: Add getEnvelopesByThreadRootId to select messages from store by thread root id Difference to getEnvelopeThread is that store.envelopes is used instead of the threads list inside a given envelope. Signed-off-by: Daniel Kesselberg --- src/store/getters.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/store') diff --git a/src/store/getters.js b/src/store/getters.js index 9e4e59518..6d5204fd6 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -import { defaultTo, head, sortBy, prop } from 'ramda' +import { defaultTo, head, prop, sortBy } from 'ramda' import { UNIFIED_ACCOUNT_ID } from './constants' import { normalizedEnvelopeListId } from './normalization' @@ -70,6 +70,12 @@ export const getters = { const list = getters.getMailbox(mailboxId).envelopeLists[normalizedEnvelopeListId(query)] || [] return list.map((msgId) => state.envelopes[msgId]) }, + getEnvelopesByThreadRootId: (state) => (accountId, threadRootId) => { + return sortBy( + prop('dateInt'), + Object.values(state.envelopes).filter(envelope => envelope.accountId === accountId && envelope.threadRootId === threadRootId) + ) + }, getMessage: (state) => (id) => { return state.messages[id] }, -- cgit v1.2.3