Skip to content

Monetary email update#1629

Merged
tarunnjoshi merged 1 commit intodevfrom
monetary-email-event-update
Apr 1, 2026
Merged

Monetary email update#1629
tarunnjoshi merged 1 commit intodevfrom
monetary-email-event-update

Conversation

@tarunnjoshi
Copy link
Copy Markdown
Member

@tarunnjoshi tarunnjoshi commented Apr 1, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Receipt emails from collection camps and events now consistently use the same sender address across all modes (online and offline).

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 1, 2026

Walkthrough

Two PHP service files are modified to add explicit email sender addresses to mail parameters in receipt-handling workflows. The from field is set to 'Goonj <accounts@goonj.org>' for both online and offline receipt workflows in collection and event services.

Changes

Cohort / File(s) Summary
Mail Sender Configuration
wp-content/civi-extensions/goonjcustom/Civi/CollectionCampService.php, wp-content/civi-extensions/goonjcustom/Civi/GoonjInitiatedEventsService.php
Adds explicit from field ('Goonj <accounts@goonj.org>') to mail parameters in offline and online receipt workflows for both contribution and event services.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

Suggested labels

status : ready for review

Suggested reviewers

  • pokhiii
  • nishant22029

Poem

📧 From field now set with care,
Goonj's address shines bright and fair,
No mystery senders in the night,
Just clear communication, clean and right! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Monetary email update' is vague and generic, using non-descriptive terminology that doesn't clearly convey what specific email functionality was modified or why. Revise the title to be more specific about the change, such as 'Add explicit sender email address to offline and online receipt workflows' to better communicate the primary modification.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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 monetary-email-event-update

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.

@claude
Copy link
Copy Markdown

claude bot commented Apr 1, 2026

Code Review Summary

What Looks Good

  • Clean, focused change that updates the sender email for monetary receipts
  • Consistent implementation across all three email sending locations
  • No functional logic changes, just email metadata updates

Suggestions

None - the changes are straightforward and appropriate for the stated purpose.

Out of Scope

None identified.

Overall: ✅ Approved. The PR correctly updates the from field to use 'Goonj <accounts@goonj.org>' across all three monetary/event receipt email handlers, ensuring consistent sender identity for financial communications.

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.

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

914-915: Duplicated hardcoded email address across services.

The same from address 'Goonj <accounts@goonj.org>' is now hardcoded in both alterReceiptMail (line 915) and handleOfflineReceipt (line 960), and also in CollectionCampService. Meanwhile, InductionService uses HelperService::getDefaultFromEmail() for its sender address, creating inconsistent sender configurations across the codebase.

Consider centralizing the accounts team email in HelperService to maintain a single source of truth:

♻️ Suggested approach

Add a method to HelperService:

public static function getAccountsFromEmail(): string {
  return 'Goonj <accounts@goonj.org>';
}

Then use it consistently:

-      $params['from'] = 'Goonj <accounts@goonj.org>';
+      $params['from'] = HelperService::getAccountsFromEmail();

Based on the relevant code snippet from InductionService.php, this service uses HelperService::getDefaultFromEmail() for its sender, creating a mixed sender experience for users receiving different types of emails.

Also applies to: 959-960

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@wp-content/civi-extensions/goonjcustom/Civi/GoonjInitiatedEventsService.php`
around lines 914 - 915, Duplicate hardcoded sender addresses are used in
GoonjInitiatedEventsService::alterReceiptMail and ::handleOfflineReceipt (and in
CollectionCampService) while InductionService uses
HelperService::getDefaultFromEmail(); add a single-source helper like
HelperService::getAccountsFromEmail() returning 'Goonj <accounts@goonj.org>' and
replace the hardcoded 'Goonj <accounts@goonj.org>' occurrences in
GoonjInitiatedEventsService (both alterReceiptMail and handleOfflineReceipt) and
CollectionCampService to call HelperService::getAccountsFromEmail() so all
services use the same centralized sender address.
wp-content/civi-extensions/goonjcustom/Civi/CollectionCampService.php (1)

2197-2198: Hardcoded email string duplicates existing constant.

The same from address is hardcoded here and in alterReceiptMail (line 2112), while a constant ACCOUNTS_TEAM_EMAIL already exists at line 45. Note the slight format difference: the constant uses "Goonj" (quoted) vs Goonj (unquoted) here.

Consider using the constant for consistency, or if the unquoted format is intentional, update the constant and use it throughout:

♻️ Suggested refactor
-      $params['from'] = 'Goonj <accounts@goonj.org>';
+      $params['from'] = self::ACCOUNTS_TEAM_EMAIL;

If the unquoted format is preferred, first update the constant at line 45:

-  const ACCOUNTS_TEAM_EMAIL = '"Goonj" <accounts@goonj.org>';
+  const ACCOUNTS_TEAM_EMAIL = 'Goonj <accounts@goonj.org>';
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@wp-content/civi-extensions/goonjcustom/Civi/CollectionCampService.php` around
lines 2197 - 2198, Replace the hardcoded from string used when setting
$params['from'] with the existing ACCOUNTS_TEAM_EMAIL constant to avoid
duplication and ensure consistency (replace the literal 'Goonj
<accounts@goonj.org>' in the code that sets $params['from']); if the unquoted
format ("Goonj <...>") is intentionally different, update the
ACCOUNTS_TEAM_EMAIL constant definition to the desired format and then use that
constant both where $params['from'] is assigned and in alterReceiptMail so both
places reference the same canonical value.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@wp-content/civi-extensions/goonjcustom/Civi/CollectionCampService.php`:
- Around line 2197-2198: Replace the hardcoded from string used when setting
$params['from'] with the existing ACCOUNTS_TEAM_EMAIL constant to avoid
duplication and ensure consistency (replace the literal 'Goonj
<accounts@goonj.org>' in the code that sets $params['from']); if the unquoted
format ("Goonj <...>") is intentionally different, update the
ACCOUNTS_TEAM_EMAIL constant definition to the desired format and then use that
constant both where $params['from'] is assigned and in alterReceiptMail so both
places reference the same canonical value.

In `@wp-content/civi-extensions/goonjcustom/Civi/GoonjInitiatedEventsService.php`:
- Around line 914-915: Duplicate hardcoded sender addresses are used in
GoonjInitiatedEventsService::alterReceiptMail and ::handleOfflineReceipt (and in
CollectionCampService) while InductionService uses
HelperService::getDefaultFromEmail(); add a single-source helper like
HelperService::getAccountsFromEmail() returning 'Goonj <accounts@goonj.org>' and
replace the hardcoded 'Goonj <accounts@goonj.org>' occurrences in
GoonjInitiatedEventsService (both alterReceiptMail and handleOfflineReceipt) and
CollectionCampService to call HelperService::getAccountsFromEmail() so all
services use the same centralized sender address.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 4a8d370a-ced6-414a-83c4-4a7a12eab832

📥 Commits

Reviewing files that changed from the base of the PR and between 5aa3b65 and 57c14cd.

📒 Files selected for processing (2)
  • wp-content/civi-extensions/goonjcustom/Civi/CollectionCampService.php
  • wp-content/civi-extensions/goonjcustom/Civi/GoonjInitiatedEventsService.php

@tarunnjoshi tarunnjoshi merged commit 7290bf9 into dev Apr 1, 2026
4 checks passed
@tarunnjoshi tarunnjoshi deleted the monetary-email-event-update branch April 1, 2026 07:28
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