From 5e77e3c98a32b29a825ddd56d105bd47a0d4531a Mon Sep 17 00:00:00 2001 From: joker-x Date: Thu, 20 Aug 2020 17:09:21 +0200 Subject: [PATCH] Added description and status:{SUBSCRIBED: 1, UNSUBSCRIBED: 2, BOUNCED: 3, COMPLAINED: 4} to response of the GET /lists/:email API Call (Fix #903) --- server/models/subscriptions.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/models/subscriptions.js b/server/models/subscriptions.js index 57f36f97..89805a8a 100644 --- a/server/models/subscriptions.js +++ b/server/models/subscriptions.js @@ -866,13 +866,14 @@ async function getListsWithEmail(context, email) { // FIXME - this methods is rather suboptimal if there are many lists. It quite needs permission caching in shares.js return await knex.transaction(async tx => { - const lsts = await tx('lists').select(['id', 'cid', 'name']); + const lsts = await tx('lists').select(['id', 'cid', 'name', 'description']); const result = []; for (const list of lsts) { await shares.enforceEntityPermissionTx(tx, context, 'list', list.id, 'viewSubscriptions'); const entity = await tx(getSubscriptionTableName(list.id)).where('hash_email', hashEmail(email)).whereNotNull('email').first(); if (entity) { + list.status=entity.status; result.push(list); } }