Skip to content
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

[REF] Clarify not-so-great code in the Group BAO #26074

Merged
merged 1 commit into from
Apr 19, 2023

Conversation

colemanw
Copy link
Member

Overview

Adds comments and a bit of tidying to some problematic code

Before

Problematic code in Group BAO; can only add parents but cannot remove them.

After

Better documented problematic code

@civibot
Copy link

civibot bot commented Apr 18, 2023

(Standard links)

@civibot civibot bot added the master label Apr 18, 2023
@@ -20,6 +20,7 @@
*/

return [
// FIXME: This is arguably the worst name for a setting ever
'is_enabled' => [
Copy link
Member Author

Choose a reason for hiding this comment

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

@eileenmcnaughton maybe we could add a way to rename and alias settings? Probably trigger a deprecation when accessed by the old name.

Copy link
Member

Choose a reason for hiding this comment

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

I believe Eileen did a rename/reformat a few years back for a setting called contribution_invoice_settings (which was apparently a pretty gnarly setting). A straight-up rename should be simpler, but the important thing is that it led to the methods SettingsBag::updateVirtual() and SettingsBag::createVirtual(). That would probably be the easiest place to inject an alias mechanism.

Copy link
Member Author

Choose a reason for hiding this comment

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

@eileenmcnaughton I feel like its time to add noisy deprecation to contribution_invoice_settings

@mattwire mattwire merged commit 40a0a31 into civicrm:master Apr 19, 2023
@colemanw colemanw deleted the groupBaoCleanup branch April 19, 2023 13:30
@colemanw
Copy link
Member Author

Thanks @mattwire!

@samuelsov
Copy link
Contributor

If we remove the parents in the CRM_Contact_BAO_Group::create function, I think this code will be redundant : https://github.com/civicrm/civicrm-core/blob/master/CRM/Group/Form/Edit.php#L372

@colemanw
Copy link
Member Author

@samuelsov yes, that's true. The code is all a bit complicated but please feel free to try a PR.

@samuelsov
Copy link
Contributor

@colemanw work done here if you want to review -> #26200

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants