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

Fix for CRM-21122: "Support selection of smart groups on Contact Dashboard" #10925

Merged

Conversation

twomice
Copy link
Contributor

@twomice twomice commented Aug 30, 2017

Overview

Changes the Contact Dashboard so that the user can join and leave publicly visible Smart Groups, just as they can on Profiles, as shown in this Profile screenshot:
profile_before

Before

Without this change, all Smart Groups are excluded from the Contact Dashboard, as shown here:
before

After

After this change, Smart Groups which are publicly visible are shown for joining and leaving on the Contact Dashboard, just as on Profiles, as shown here:
after

Technical Details

  • Besides the Contact Dashboard, this PR touches code that builds the list of groups in other contexts, such as the "Groups" tab on a Contact record. Here's a screenshot of that tab, with this code change in place; note the proper display of all groups, both smart and non-smart, both public and non-public.
    groups_tab_after

Comments

Nothing of note.


@eileenmcnaughton
Copy link
Contributor

There is a fatal error in the test

PHP Fatal error: Call to undefined function array_column() in /home/jenkins/buildkit/build/core-10925-6mvfq/sites/all/modules/civicrm/tests/phpunit/CRM/Contact/Page/View/UserDashboard/GroupContactTest.php on line 120
RUN:[[./scripts/phpunit --tap --log-junit '/home/jenkins/workspace/CiviCRM-Core-PR/junit/api_v3_AllTests.xml' '--exclude-group' 'ornery' 'api_v3_AllTests']]

Other than that @seamuslee001 do you want to put this through it's paces on performance?

@twomice
Copy link
Contributor Author

twomice commented Aug 31, 2017

Curse you, php 5.3. You haven't heard the last of me!

@twomice twomice force-pushed the CRM-21122_dashboard_allow_smart_groups branch from 8b2870f to 0763645 Compare August 31, 2017 20:43
@twomice
Copy link
Contributor Author

twomice commented Aug 31, 2017

No more array_column(). Test are passing. Take that, php 5.3!

@totten
Copy link
Member

totten commented Aug 31, 2017

You show em, @twomice! Show PHP 5.3 how real programmers vectorize the column of a multi-dimensional array!

@totten
Copy link
Member

totten commented Aug 31, 2017

Aside: There's also CRM_Utils_Array::collect().

@twomice twomice force-pushed the CRM-21122_dashboard_allow_smart_groups branch 2 times, most recently from b395bb0 to caecb7d Compare September 1, 2017 00:05
@twomice
Copy link
Contributor Author

twomice commented Sep 1, 2017

Jenkins test this please.

@twomice
Copy link
Contributor Author

twomice commented Sep 1, 2017

Thanks for the tip, @totten -- I'll buy that for a dollar. I should have guessed CRM_Utils_Array would have something.

@eileenmcnaughton
Copy link
Contributor

Php is beaten into submission. This generally looks good but I would very much like @seamuslee001 to test it with their data as I'd like to be sure there is not a performance issue with groups. @systopia or @jaapjansma might have data sets worth testing on - or @davejenx

@twomice twomice force-pushed the CRM-21122_dashboard_allow_smart_groups branch from caecb7d to ec6d2df Compare September 12, 2017 22:10
@monishdeb
Copy link
Member

@eileenmcnaughton @twomice I have a doubt - Does Civi retain manually added a contact in a smart group when contact-cache is rebuilt based on saved search criteria?

@davejenx
Copy link
Contributor

@monishdeb As a general point, manually added contacts in a smart group should be retained when group_contact_cache is rebuilt, because the manually added/removed contacts are stored in group_contact. I'm sure you know that, so is your question whether the manually added contacts are also in group_contact_cache? Or is it a question specific to the code changes in this PR?

@monishdeb
Copy link
Member

@davejenx thanks for your reply. Sorry to put this silly question w/o doing enough research on my end.

Will provide my feedback about this PR soon.

@seamuslee001
Copy link
Contributor

I tested this on an AUG install, I didn't see any obvious performance issues and i was able to confirm it now allows for public smart groups to show in the list. I think this is good to be merged

@twomice
Copy link
Contributor Author

twomice commented Oct 4, 2017

@eileenmcnaughton or @monishdeb , any possibility to merge this in based on Seamus's review?

@monishdeb
Copy link
Member

Works fine in my local and from code pov its ok to merge.

@monishdeb monishdeb merged commit e185342 into civicrm:master Oct 5, 2017
@twomice
Copy link
Contributor Author

twomice commented Oct 5, 2017

Thanks @monishdeb !

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.

7 participants