Give finished Rules a print path, folded launch counts, and a two-day follow-up. #104

Merged
an.di merged 2 commits from adilallo/feature/CR-270-CR-289-export-and-counts into main 2026-11-11 18:15:39 +00:00
Member

Overview

A finished Rule can leave the builder as something you can print or paste, not only as a screen. Export is PDF, RULE.md, and Print on US Letter. Counts of finished Rules by group type and place are readable without opening the database, and the person who holds the pen gets working download links two days later.

Changes

  • Finished-Rule export menu is PDF, RULE.md, and Print. CSV is gone. The print document is US Letter, puts every shared term at the end, and does not include member names.
  • Takeaway Tell us what this Rule changed on the finished Rule, in the footer, and on PDF / RULE.md / Print. It goes to Ask an organizer (/#ask-organizer).
  • Signed export URLs for PDF and RULE.md (GET /api/rules/[id]/export/pdf|md) so the follow-up mail can attach working links without a session.
  • Finished Rules keep group type and place. Named admins can read folded counts (cells under 5 are combined) at /rule-counts, or GET /api/ops/rule-counts. Existing Rules are copied into those columns so launch counts are not empty on first deploy.
  • Optional Umami snippet when NEXT_PUBLIC_UMAMI_SRC and NEXT_PUBLIC_UMAMI_WEBSITE_ID are set. The snippet sends no search strings. Cookie-free mode is an Umami-app setting, not this image. Privacy copy names Umami.
  • 48-hour follow-up mail to the pen-holder with PDF and RULE.md links. Guest Rules with no account are skipped until claimed. The hourly Cloudron job claims a row before sending so overlapping runs cannot deliver twice. /kit points at office hours (/workshops).

Screenshots

01-footer-takeaway.png

How to Test

  1. Finish a Rule (or reopen /create/completed after publishing). Confirm Export offers PDF, RULE.md, and Print only. Open each. Confirm no member names, shared terms at the end, and the takeaway line.
  2. Confirm Tell us what this Rule changed on the finished Rule and in the site footer. Both should land on Ask an organizer.
  3. As a named admin (RULE_ADMIN_EMAILS), open /rule-counts. Cells under 5 should be folded. Without that session, the page should not be readable.
  4. Locally: node --env-file=.env --import tsx scripts/send-rule-follow-up.ts (or Mailhog if that is up). A Rule finished ~48 hours ago for a logged-in pen-holder should get one mail with working PDF and RULE.md links. A guest Rule should not.
  5. With Umami env unset, no tracker script in the page. With both vars set, the script is present and query strings are excluded.

Notes

  • Cookie-free Umami is configured on the Umami Cloudron app, not in this image. Unset the two env vars to ship no tracker.
  • First deploy does not mail the history: Rules finished more than seven days before this mail existed are closed in the migration.
  • RULE.md does not include group type or place. That is still an open product call.
  • Print uses a pop-up; if the browser blocks it, the existing “allow pop-ups” alert is the path.
  • Scheduler: Cloudron follow-up-mail at 15 minutes past every hour. Manual: node /app/follow-up-mail.bundle.cjs on the box.02-finished-rule-takeaway.png03-export-menu.png04-print-layout.png05-print-takeaway.png[06-follow-up-email](uploading ...)
## Overview A finished Rule can leave the builder as something you can print or paste, not only as a screen. Export is PDF, RULE.md, and Print on US Letter. Counts of finished Rules by group type and place are readable without opening the database, and the person who holds the pen gets working download links two days later. ## Changes - Finished-Rule export menu is **PDF**, **RULE.md**, and **Print**. CSV is gone. The print document is US Letter, puts every shared term at the end, and does not include member names. - Takeaway **Tell us what this Rule changed** on the finished Rule, in the footer, and on PDF / RULE.md / Print. It goes to Ask an organizer (`/#ask-organizer`). - Signed export URLs for PDF and RULE.md (`GET /api/rules/[id]/export/pdf|md`) so the follow-up mail can attach working links without a session. - Finished Rules keep group type and place. Named admins can read folded counts (cells under 5 are combined) at `/rule-counts`, or `GET /api/ops/rule-counts`. Existing Rules are copied into those columns so launch counts are not empty on first deploy. - Optional Umami snippet when `NEXT_PUBLIC_UMAMI_SRC` and `NEXT_PUBLIC_UMAMI_WEBSITE_ID` are set. The snippet sends no search strings. Cookie-free mode is an Umami-app setting, not this image. Privacy copy names Umami. - 48-hour follow-up mail to the pen-holder with PDF and RULE.md links. Guest Rules with no account are skipped until claimed. The hourly Cloudron job claims a row before sending so overlapping runs cannot deliver twice. `/kit` points at office hours (`/workshops`). ## Screenshots ![01-footer-takeaway.png](attachments/893ad5d6-d746-4985-bed6-8a30a80ef39e) ## How to Test 1. Finish a Rule (or reopen `/create/completed` after publishing). Confirm **Export** offers PDF, RULE.md, and Print only. Open each. Confirm no member names, shared terms at the end, and the takeaway line. 2. Confirm **Tell us what this Rule changed** on the finished Rule and in the site footer. Both should land on Ask an organizer. 3. As a named admin (`RULE_ADMIN_EMAILS`), open `/rule-counts`. Cells under 5 should be folded. Without that session, the page should not be readable. 4. Locally: `node --env-file=.env --import tsx scripts/send-rule-follow-up.ts` (or Mailhog if that is up). A Rule finished ~48 hours ago for a logged-in pen-holder should get one mail with working PDF and RULE.md links. A guest Rule should not. 5. With Umami env unset, no tracker script in the page. With both vars set, the script is present and query strings are excluded. ## Notes - Cookie-free Umami is configured on the Umami Cloudron app, not in this image. Unset the two env vars to ship no tracker. - First deploy does not mail the history: Rules finished more than seven days before this mail existed are closed in the migration. - RULE.md does not include group type or place. That is still an open product call. - Print uses a pop-up; if the browser blocks it, the existing “allow pop-ups” alert is the path. - Scheduler: Cloudron `follow-up-mail` at 15 minutes past every hour. Manual: `node /app/follow-up-mail.bundle.cjs` on the box.![02-finished-rule-takeaway.png](attachments/0550f0ac-a9db-4eaf-8451-4864c4a102a4)![03-export-menu.png](attachments/88879a1d-d6d0-4006-9415-a454b4d2dc8c)![04-print-layout.png](attachments/e55febe1-67a7-4266-aaf4-f93d3b48698f)![05-print-takeaway.png](attachments/43804544-6ac7-4ffa-85e7-c2c9014df113)[06-follow-up-email](uploading ...)
an.di added 2 commits 2026-11-11 18:01:15 +00:00
Export is PDF, RULE.md, and Print on US Letter, with every shared term, no member names, and a takeaway that points at Ask an organizer. Finished Rules keep type and place so the team can read folded counts without a database, Umami can sit beside the app with no cookies, and the person who holds the pen gets working PDF and RULE.md links 48 hours later.
an.di merged commit b4ee923109 into main 2026-11-11 18:15:39 +00:00
an.di deleted branch adilallo/feature/CR-270-CR-289-export-and-counts 2026-11-11 18:15:39 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: CommunityRule/community-rule#104