mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-30 16:33:16 +00:00
fix(journey): the digest of a protected link names no entry
A follower keeps getting the daily mail after the owner puts a password on the link or changes it, so the mail named titles, dates and places the password was meant to guard. For a link behind a password the digest now only says there is something new and links to the journey.
This commit is contained in:
@@ -438,4 +438,26 @@ describe('the daily digest', () => {
|
||||
expect(await digest.run(new Date())).toMatchObject({ journeys: 0, mailed: 0 });
|
||||
expect(send).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('JSOCIAL-E2E-031: a follower of a link that got a password hears of something new, never what', async () => {
|
||||
const send = mailWorks();
|
||||
const { owner, journey } = await journeyWithPeople();
|
||||
const token = await share(journey.id, owner.id, { allow_subscriptions: true });
|
||||
await request(server).post(`/api/public/journey/${token}/subscribe`).send({ email: 'locked-out@example.com' });
|
||||
const follower = must(await findRow(orm, JourneyShareSubscribers, { email: 'locked-out@example.com' }));
|
||||
await request(server).post('/api/public/journey-subscriptions/confirm').send({ token: follower.confirm_token });
|
||||
await share(journey.id, owner.id, { password: 'a new secret' });
|
||||
send.mockClear();
|
||||
|
||||
await makeJourneyEntry(orm, journey.id, owner.id, { title: 'Behind the password', location_name: 'Furnas' });
|
||||
await app.get(JourneyDigestService, { strict: false }).run(new Date());
|
||||
await notifications.settled();
|
||||
|
||||
const mails = send.mock.calls.filter(([to]) => to === 'locked-out@example.com');
|
||||
expect(mails).toHaveLength(1);
|
||||
const [, mail] = must(mails[0]);
|
||||
expect(mail.body).not.toContain('Behind the password');
|
||||
expect(mail.body).not.toContain('Furnas');
|
||||
expect(mail.cta.href).toContain(`/public/journey/${token}`);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -114,6 +114,13 @@ describe('the mails of a follower', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('JSOCIAL-HELP-014: a digest without entries only says there is something new, without a dangling colon', () => {
|
||||
const en = digestMail('en', 'Azores', [], { link: 'tok', unsubscribe: 'u' });
|
||||
expect(en.body).toBe('There is something new to read in "Azores"');
|
||||
expect(en.cta.href).toMatch(/\/public\/journey\/tok$/);
|
||||
expect(digestMail('ja', 'Azores', [], { link: 'tok', unsubscribe: 'u' }).body).not.toMatch(/[::]$/);
|
||||
});
|
||||
|
||||
it('JSOCIAL-HELP-012: a follower language is one the app ships, else English', () => {
|
||||
expect(subscriberLocale('fr')).toBe('fr');
|
||||
expect(subscriberLocale('klingon')).toBe('en');
|
||||
|
||||
Reference in New Issue
Block a user