Teaching: hide-notes-until share, session length check, slides export
- A study share link can hide the owner's notes until a chosen time: the server sends only passages and discussion questions until then, with a banner in the shared view (new share_reveal column, migrated on start). - Outline: a session length with "N of M min planned, X min over" and a marker on the point where the plan runs past it. - Export > Slides: printable 16:9 slides (title, passage, outline points with their verse, discussion questions) for one session or all; light or dark. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
67645cf1df
commit
2c7c7145c4
14 files changed
+303
-33
No files matched your search
@@ -31,3 +31,36 @@ test('an expired link is reported as expired even before the passcode is checked
|
||||
const passHash = await hashPasscode('x');
|
||||
expect(await checkShareAccess({ passHash, expiresAt: NOW - 5, supplied: 'x' }, NOW)).toMatchObject({ status: 410 });
|
||||
});
|
||||
|
||||
import { hideUntilReveal, revealFromInput } from './shareLinks.js';
|
||||
|
||||
const study = () => ({
|
||||
id: 's1', title: 'John', translation: 'BSB', outline: [{ id: 'n', text: 'Point' }],
|
||||
chapters: [{ book: 'John', bookAbbrev: 'JHN', chapter: '3', verses: [{ number: 16, text: 'For God so loved.' }],
|
||||
chunks: [{ id: 'c', startVerse: 16, endVerse: 18, discussionQuestions: 'Why?', observation: 'secret', interpretation: 'secret', application: 'secret', finalScript: 'secret', generalNotes: 'secret', greekWords: [{ id: 'w' }], teachBack: 'secret', recalls: [{ text: 'secret' }] }] }],
|
||||
});
|
||||
|
||||
test('before the reveal time a shared study keeps the passages and questions and drops every note', () => {
|
||||
const now = 1_000;
|
||||
const out = hideUntilReveal(study(), now + 5_000, now);
|
||||
expect(out.hiddenUntil).toBe(now + 5_000);
|
||||
expect(out.outline).toEqual([]);
|
||||
expect(out.chapters[0].verses).toHaveLength(1);
|
||||
expect(out.chapters[0].chunks[0]).toEqual({ id: 'c', startVerse: 16, endVerse: 18, discussionQuestions: 'Why?' });
|
||||
expect(JSON.stringify(out)).not.toContain('secret');
|
||||
});
|
||||
|
||||
test('after the reveal time, or with none set, the whole study is sent', () => {
|
||||
const full = study();
|
||||
expect(hideUntilReveal(full, 500, 1_000)).toBe(full);
|
||||
expect(hideUntilReveal(full, null, 1_000)).toBe(full);
|
||||
});
|
||||
|
||||
test('a reveal time must be in the future, and no more than a year away', () => {
|
||||
const now = 1_000_000;
|
||||
expect(revealFromInput(null, now)).toBeNull();
|
||||
expect(revealFromInput(now - 1, now)).toBeNull();
|
||||
expect(revealFromInput('nope', now)).toBeNull();
|
||||
expect(revealFromInput(now + 60_000, now)).toBe(now + 60_000);
|
||||
expect(revealFromInput(now + 10 * 365 * 86_400_000, now)).toBe(now + 365 * 86_400_000);
|
||||
});
|
||||
Reference in new issue
Block a user