diff options
author | Daniel Kesselberg <mail@danielkesselberg.de> | 2021-08-31 18:42:11 +0300 |
---|---|---|
committer | Daniel Kesselberg <mail@danielkesselberg.de> | 2022-06-01 10:17:20 +0300 |
commit | a56f68d9ba55a5986d2f0d3e865dff7f3115aeab (patch) | |
tree | b0ad0c585d40571ac3bf887d9ffdeaa4534d487e /src/store | |
parent | 1a0e6195875307d8bc03ed48e5b3d8a83c328efd (diff) |
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 <mail@danielkesselberg.de>
Diffstat (limited to 'src/store')
-rw-r--r-- | src/store/getters.js | 8 |
1 files changed, 7 insertions, 1 deletions
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 <http://www.gnu.org/licenses/>. */ -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] }, |