-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move from_email_address
options to new SiteEmailAddresses entity
#31909
Conversation
🤖 Thank you for contributing to CiviCRM! ❤️ We will need to test and review this PR. 👷 Introduction for new contributors...
Quick links for reviewers...
|
85d2958
to
1c5672a
Compare
Personal feeling: yes, please, for the love of god, yes. Big consideration is going to be technical interop for extensions and sysadmin scripts. (In my copy of (Like... In the future, we may get some better options to address permissions and routing if it's a proper entity. Small aside |
I don't deal with from_email_address much, but the proposed schema looks good to me. What would be the best practice in Civi for maintaining a single |
UPDATE: You can't do that sort of unique index in mySql, unfortunately, but I did add the business logic to enforce it during every write operation that goes through the Api/BAO. |
Well in Civi-land, |
a074321
to
8125154
Compare
Ah, good point. Terms are painted into a corner. Dealers choice. |
5658e96
to
ba3bdc6
Compare
CRM/Upgrade/Incremental/schema/6.0.alpha1.DomainEmailAddress.entityType.php
Outdated
Show resolved
Hide resolved
ba3bdc6
to
8d98958
Compare
8d98958
to
571ef84
Compare
from_email_address
options to new DomainEmailAddresses table
f8d1eb4
to
b59c4a7
Compare
'browse' => 'civicrm/admin/options/from_email_address', | ||
'add' => 'civicrm/admin/form/site-email-address', | ||
'update' => 'civicrm/admin/form/site-email-address#?email=[id]', | ||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, sensible functionality, but this highlights some confusion in naming:
- Before: one phrase, "from email address"
- After: three phrases, varying by context:
- Sometimes "domain email address" (eg APIv4 and SQL)
- Sometimes "site email address" (eg new routes)
- Sometimes "from email address" (eg existing routes)
Each name has its own semantic niggles, so I can share some ambivalence. And TBH, I hardly noticed that the initial draft spoke to from_email_address
and DomainEmailAddress
. (The option-group namespace differs from the APIv4 namespace, so sure... there's gonna be something different there.)
But three different names? That's gonna be confusing later, right?
(If there is some ambiguity for the name of this $thing
, then I guess... the protocol is to talk that through and pick one?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for switching to Site Email Address everywhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with @ufundo. I consider "Domain" to be techie speak for "Website" or just "Site" so this PR as-is moves us in the direction of:
- Entity/Api name: DomainEmailAddress
- User-facing name: Site Email Address
All that's left is to cleanup the old references to "from_email_address"
Yeah, fair enough. We can do There may exist some good use-case for machine |
OK, so I did some light/local r-run with an upgrade scenario. The idea is:
The main thing that stuck to me is the change re: ordering/weights. This isn't mentioned in the "Description", but (in usage) it was apparent on both the UI level and API level.
|
+1 for Site Email Address over Domain Email Address or From Email Address (commented in a thread above but just collating here) +1 for display_name Machine I'm with @eileenmcnaughton that there could be all kinds of uses for machine named records.
I don't dislike that auto-generated machine I do think it's unfortunate that you get FIXME in the starting one. Could we hard code a value for that one "initial"? I also think it would be good (and consistent) to munge what goes into the Having said all this - it looks like adding a |
Definitely! I'm not about to make this PR any bigger than it already is.
Exactly. Also, just to make the obvious point, Re the |
07066cb
to
f624930
Compare
I've rebased/pushed this PR to address the following
I also looked into @totten's testing of the is_default flag behavior on email-related screens. I agree it's not working as expected in this PR, but then I build a vanilla site from master and got the exact same behavior. So the not-workingness is a pre-existing condition and I'm happy to take a look at it but am wary of bogging down this PR even more so I opened a new issue for that bug. |
4a9a5cf
to
a229329
Compare
from_email_address
options to new DomainEmailAddresses tablefrom_email_address
options to new SiteEmailAddresses entity
Introduce a new entity type `SiteEmailAddress` as a replacement to the 'from_email_address' option group.
Replaced legacy "from_email_address" option group references with the new API.
Also removed unnecessary domain filtering logic from OptionValue as this was the only option group it applied to.
Wraps the OptionValue api (v3 and v4) to provide backward compatibility for accessing SiteEmailAddress via the OptionValue api. CRM_Core_OptionGroup::values and ::getDefaultValue are also supported.
Also removes unused handling from the optionValue quickform
…eAndEmail Deprecated the `returnFormatted` parameter in `getNameAndEmail` and updated relevant code to align with the new method.
Consistently use "Site Email Addresses" instead of "FROM Email Addresses" (and no need to SHOUT).
a229329
to
ccfcdd5
Compare
Re-tested. Added a couple more tweaks. Merge on pass. |
Now that the last 2 domain-specific option groups have been dealt with: - civicrm#31909 - civicrm#31924 ... we can stop using this godawful is_domain column for good. The OptionValue table is complex enough without it!
Overview
Moves the 'from_email_address' option group into its own table: Introducing the new
SiteEmailAddress
entity. 🎉Migration and Backward Compatibility Notes
New-to-Old column map
id
value
display_name
label
(in quotes)email
label
(in brackets)description
description
is_active
is_active
is_default
is_default
domain_id
domain_id
Backward Compatibility
This adds an apiWrapper for backward-compatibility, to allow
SiteEmailAddress
records to be accessed as if it were an option group. When accessing it via the OptionValue api, the newemail
anddisplay_name
columns are concatenated to produce familiarvalue
of"Name" <[email protected]>
, andid
is returned asvalue
. Here's what is and is not supported:$params
must contain'option_group_id' => 'from_email_address'
$params
must contain'option_group_id' => 'from_email_address'
create
+ anid
)id
of an existing siteEmailAddress and a correctly formatted email header asvalue
delete
action only gets passed anid
which is not enough info for the adapterget
chained with create/update/delete will all workWHERE
must contain'option_group_id:name', '=', 'from_email_address'
WHERE
must contain'option_group_id:name', '=', 'from_email_address'
$values
must contain'option_group_id:name' => 'from_email_address'
WHERE
must contain'option_group_id:name', '=', 'from_email_address'
universe
so didn't add support for thisCRM_Core_BAO_Domain::getNameAndEmail
CRM_Core_BAO_Domain::getFromEmail
CRM_Core_BAO_Email::getFromEmail()
CRM_Core_BAO_Email::domainEmails()
CRM_Core_OptionGroup::values
$labelColumnName
,$keyColumnName
,$onlyActive
,$condition
CRM_Core_OptionGroup::getDefaultValue
id
of default email address for current domainCRM_Core_OptionGroup::valuesByID
,CRM_Core_Pseudoconstant::get
, etc.civicrm_option_value
table so can't be queried.Before
The list of from email addresses was not well-placed in the OptionValue table because:
"My Name" <[email protected]>
which wasn't fun for users to type and involved a lot of splitting/unsplitting strings.<
and>
characters, making general rules about html escaping difficult.After
New table has just the fields needed for storing site email addresses. UI switched to SearchKit/FormBuilder: