Skip to content

Update email template for team 5000#1632

Merged
tarunnjoshi merged 2 commits intodevfrom
update-email-template-for-team-5000
Apr 3, 2026
Merged

Update email template for team 5000#1632
tarunnjoshi merged 2 commits intodevfrom
update-email-template-for-team-5000

Conversation

@tarunnjoshi
Copy link
Copy Markdown
Member

@tarunnjoshi tarunnjoshi commented Apr 3, 2026

Update email template for team 5000

Summary by CodeRabbit

  • Bug Fixes
    • Updated subscription renewal reminder timing: notifications now send at 30, 7, and 2 days before expiration (was 7, 3, and 1 days).
  • New Features
    • Reminder subjects use clearer interval labels (e.g., "1 Month", "7 Days", "2 Days") with numeric fallbacks.
  • Style
    • Emails now use a single, consistent message referencing the subscription end date and include a fixed renewal link and updated support address; donor name and amount are no longer shown.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 3, 2026

Walkthrough

Updated Team5000SubscriptionReminderService: reminder windows changed from [7,3,1] to [30,7,2]; email subject mapping rewritten to label 30/7/2; HTML email generation simplified and no longer includes donor name, daysBefore, or amount; idempotency subject suffixes/filters updated accordingly. (49 words)

Changes

Cohort / File(s) Summary
Subscription Reminder Service
wp-content/civi-extensions/goonjcustom/Civi/Team5000SubscriptionReminderService.php
Changed REMINDER_DAYS from [7,3,1] to [30,7,2]; updated idempotency subject suffix logic; replaced subject special-case with explicit label mapping for 30/7/2; simplified HTML email generation (removed donor name, daysBefore, amount; fixed renewal link and support email).
Code quality notes
wp-content/civi-extensions/goonjcustom/Civi/Team5000SubscriptionReminderService.php
Concise changes but potentially reduce personalization (donor name/amount removed) and couple presentation logic into the service; check for single-responsibility violations and ensure idempotency subject change aligns with other filters/consumers.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • pokhiii

Poem

📬 Thirty, seven, two now mark the call,
Old salutations trimmed down small,
Subjects renamed, the links set straight,
Reminders march to a different date. ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: updating the email template for team 5000, which is the primary focus of the file modification.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch update-email-template-for-team-5000

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
wp-content/civi-extensions/goonjcustom/Civi/Team5000SubscriptionReminderService.php (1)

10-20: Stale class documentation.

The docblock at lines 13-14 still references the old reminder schedule ("7, 3, and 1 day(s)") but REMINDER_DAYS is now [30, 7, 2]. Additionally, the cron file at wp-content/civi-extensions/goonjcustom/api/v3/Goonjcustom/Team5000SubscriptionReminderCron.php (lines 6-7) contains the same outdated comment.

📝 Proposed fix for class docblock
 /**
  * Handles subscription expiry reminder emails for Team 5000 donors.
  *
- * Sends reminders at 7, 3, and 1 day(s) before the calculated subscription
+ * Sends reminders at 30, 7, and 2 day(s) before the calculated subscription
  * end date. Logs a CiviCRM activity after each send to prevent duplicates.
  */
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@wp-content/civi-extensions/goonjcustom/Civi/Team5000SubscriptionReminderService.php`
around lines 10 - 20, Update the stale docblocks to match the current reminder
schedule: edit the class docblock for Team5000SubscriptionReminderService and
the header comment in Team5000SubscriptionReminderCron (the cron file
referenced) so the textual reminder days reflect REMINDER_DAYS (30, 7, 2)
instead of the old "7, 3, and 1 day(s)". Keep the wording concise and consistent
with the constant REMINDER_DAYS and existing descriptions (e.g., "Sends
reminders at 30, 7, and 2 day(s) before the calculated subscription end date").
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@wp-content/civi-extensions/goonjcustom/Civi/Team5000SubscriptionReminderService.php`:
- Around line 287-299: The getReminderEmailHtml function currently accepts
$donorName and $daysBefore but doesn't use them; either personalize the template
by interpolating $donorName into the greeting and include $daysBefore in the
expiration sentence (e.g., "set to expire in {$daysBefore} days") inside
getReminderEmailHtml, or remove those parameters from getReminderEmailHtml and
update all callers to stop passing them; ensure you modify the function
signature and every invocation consistently (references: getReminderEmailHtml).

---

Nitpick comments:
In
`@wp-content/civi-extensions/goonjcustom/Civi/Team5000SubscriptionReminderService.php`:
- Around line 10-20: Update the stale docblocks to match the current reminder
schedule: edit the class docblock for Team5000SubscriptionReminderService and
the header comment in Team5000SubscriptionReminderCron (the cron file
referenced) so the textual reminder days reflect REMINDER_DAYS (30, 7, 2)
instead of the old "7, 3, and 1 day(s)". Keep the wording concise and consistent
with the constant REMINDER_DAYS and existing descriptions (e.g., "Sends
reminders at 30, 7, and 2 day(s) before the calculated subscription end date").
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 6b4f7750-abc4-4506-a207-4cbe4f779d5c

📥 Commits

Reviewing files that changed from the base of the PR and between f752cb6 and 294d2d8.

📒 Files selected for processing (1)
  • wp-content/civi-extensions/goonjcustom/Civi/Team5000SubscriptionReminderService.php

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
wp-content/civi-extensions/goonjcustom/Civi/Team5000SubscriptionReminderService.php (1)

10-15: ⚠️ Potential issue | 🟡 Minor

Stale docblock: reminder windows documented as 7/3/1 but code uses 30/7/2.

The class-level comment references the old reminder schedule. Update it to reflect the new windows [30, 7, 2] to avoid confusing future maintainers.

📝 Suggested fix
 /**
  * Handles subscription expiry reminder emails for Team 5000 donors.
  *
- * Sends reminders at 7, 3, and 1 day(s) before the calculated subscription
+ * Sends reminders at 30, 7, and 2 day(s) before the calculated subscription
  * end date. Logs a CiviCRM activity after each send to prevent duplicates.
  */
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@wp-content/civi-extensions/goonjcustom/Civi/Team5000SubscriptionReminderService.php`
around lines 10 - 15, Update the stale class-level docblock on
Team5000SubscriptionReminderService to reflect the current reminder schedule of
30, 7, and 2 days (instead of 7, 3, and 1); edit the comment block above the
class declaration so the description and any listed reminder windows match the
actual values used by the class (e.g., the reminder windows array or logic that
schedules sends) to avoid future confusion.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@wp-content/civi-extensions/goonjcustom/Civi/Team5000SubscriptionReminderService.php`:
- Around line 290-299: The email body in Team5000SubscriptionReminderService
(the HTML-returning method that builds the reminder body) says "expire in a few
days" which conflicts with the 30-day "1 Month" subject; update the body text to
be consistent by either using neutral phrasing like "is approaching" or accept
and interpolate the expiry label (e.g., pass an $expiryLabel into the method
that builds the HTML and replace "in a few days" with "in {$expiryLabel}" or
similar) so getReminderEmailHtml (or the method that returns the HTML) matches
the subject across all reminder windows.

---

Outside diff comments:
In
`@wp-content/civi-extensions/goonjcustom/Civi/Team5000SubscriptionReminderService.php`:
- Around line 10-15: Update the stale class-level docblock on
Team5000SubscriptionReminderService to reflect the current reminder schedule of
30, 7, and 2 days (instead of 7, 3, and 1); edit the comment block above the
class declaration so the description and any listed reminder windows match the
actual values used by the class (e.g., the reminder windows array or logic that
schedules sends) to avoid future confusion.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 92cb9b1e-8a8d-47ac-88cb-b698c2e526d4

📥 Commits

Reviewing files that changed from the base of the PR and between 294d2d8 and 35b1114.

📒 Files selected for processing (1)
  • wp-content/civi-extensions/goonjcustom/Civi/Team5000SubscriptionReminderService.php

Comment on lines 290 to 299
return "
<p>Dear <strong>{$donorName}</strong>,</p>
<p>Greetings from Goonj!</p>
<p>{$urgencyLine}</p>
<p>Your Team 5000 membership is set to expire on <strong>{$formattedDate}</strong>.</p>
{$amountLine}
<p>Your generosity has been a cornerstone of our work — empowering communities, restoring dignity, and creating lasting change. We truly value your commitment to this journey.</p>
<p>To continue your support and ensure your membership stays active, we warmly invite you to renew your Team 5000 membership at your earliest convenience.</p>
<p>For any questions or assistance, please feel free to write to us at <a href='mailto:accounts@goonj.org'>accounts@goonj.org</a>.</p>
<p>Thank you for being a vital part of Team 5000 — together, we are making a difference!</p>
<p>Warm regards,<br>Team Goonj</p>
<p>Just a gentle reminder that your Team 5000 membership is set to expire in a few days (on <strong>{$formattedDate}</strong>).</p>
<p>We truly hope you'll continue this journey with us.</p>
<p>Your contribution has been making a meaningful difference, helping us reach communities that need it most.</p>
<p>We warmly invite you to renew your Team 5000 membership at your earliest convenience by clicking this link <a href='https://goonj.org/donate/campaign/team-5000-new'>https://goonj.org/donate/campaign/team-5000-new</a></p>
<p>Kindly ignore if you have already renewed your contribution. If you have any questions or need assistance, please feel free to write to us at <a href='mailto:priyanka@goonj.org'>priyanka@goonj.org</a>.</p>
<p>Thank you for being such an important part of Team 5000. Together, we are creating real impact.</p>
<p>Warm regards<br>Team Goonj</p>
";
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Email body says "a few days" but the 30-day reminder contradicts this.

The subject correctly states "1 Month" for the 30-day window, but the body still says "expire in a few days." This inconsistency could confuse recipients.

Consider making the body text match the subject's specificity, or use neutral phrasing like "is approaching" that works for all windows.

📝 Option A: Generic phrasing that works for all windows
     return "
       <p>Greetings from Goonj!</p>
-      <p>Just a gentle reminder that your Team 5000 membership is set to expire in a few days (on <strong>{$formattedDate}</strong>).</p>
+      <p>Just a gentle reminder that your Team 5000 membership is set to expire on <strong>{$formattedDate}</strong>.</p>
       <p>We truly hope you'll continue this journey with us.</p>
📝 Option B: Pass the label to the template for consistency

Update signature and call site to pass the label:

// In getEmailSubject, extract label lookup to a separate method or pass it
private static function getReminderEmailHtml(string $endDate, string $expiryLabel): string {
    // ...
    return "
      <p>Just a gentle reminder that your Team 5000 membership is set to expire in <strong>{$expiryLabel}</strong> (on <strong>{$formattedDate}</strong>).</p>
      // ...
    ";
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@wp-content/civi-extensions/goonjcustom/Civi/Team5000SubscriptionReminderService.php`
around lines 290 - 299, The email body in Team5000SubscriptionReminderService
(the HTML-returning method that builds the reminder body) says "expire in a few
days" which conflicts with the 30-day "1 Month" subject; update the body text to
be consistent by either using neutral phrasing like "is approaching" or accept
and interpolate the expiry label (e.g., pass an $expiryLabel into the method
that builds the HTML and replace "in a few days" with "in {$expiryLabel}" or
similar) so getReminderEmailHtml (or the method that returns the HTML) matches
the subject across all reminder windows.

@tarunnjoshi tarunnjoshi merged commit 829f31e into dev Apr 3, 2026
1 check passed
@tarunnjoshi tarunnjoshi deleted the update-email-template-for-team-5000 branch April 3, 2026 06:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant