commit
613a6fb1f0
3 changed files with 183 additions and 51 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ router.postAsync('/unsubscribe/:listCid', passport.loggedIn, async (req, res) =>
|
|||
res.status(200);
|
||||
res.json({
|
||||
data: {
|
||||
id: subscription.id,
|
||||
id: subscription.cid,
|
||||
unsubscribed: true
|
||||
}
|
||||
});
|
||||
|
@ -133,7 +133,7 @@ router.postAsync('/delete/:listCid', passport.loggedIn, async (req, res) => {
|
|||
res.status(200);
|
||||
res.json({
|
||||
data: {
|
||||
id: subscription.id,
|
||||
id: subscription.cid,
|
||||
deleted: true
|
||||
}
|
||||
});
|
||||
|
@ -227,7 +227,7 @@ router.postAsync('/field/:listCid', passport.loggedIn, async (req, res) => {
|
|||
input[(key || '').toString().trim().toUpperCase()] = (req.body[key] || '').toString().trim();
|
||||
});
|
||||
|
||||
const key = (input.NAME || '').toString().trim() || slugify('merge ' + name, '_').toUpperCase();
|
||||
const key = slugify('merge ' + input.NAME, '_').toUpperCase();
|
||||
const visible = ['false', 'no', '0', ''].indexOf((input.VISIBLE || '').toString().toLowerCase().trim()) < 0;
|
||||
|
||||
const groupTemplate = (input.GROUP_TEMPLATE || '').toString().toLowerCase().trim();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue