cuny-academic-commons / commons-in-a-box

Commons In A Box - A suite of community and collaboration tools for WordPress, designed especially for academic communities
http://commonsinabox.org
72 stars 14 forks source link

Ability to apply member profile privacy controls to avatar #480

Closed bree-z closed 2 months ago

bree-z commented 3 months ago

This would apply the privacy controls ("Who can see this field?") that exist for other fields on the member profile to a member's avatar.

TBD whether this can go into the 1.6.0 milestone.

boonebgorges commented 3 months ago

I managed to get a version of this working.

I put the 'Avatar Privacy' controls on the Change Avatar screen. I couldn't think of a better place. I put it inside of a separate "panel" with the heading 'Avatar Privacy'.

Because it's on the Change Avatar screen, it's not feasible to have the same sort of click-to-submit save routine as on the profile edit page. So I've made it save via AJAX. I added some subtle opacity changes to indicate that saving is taking place. IMO this is fairly clear, but if others feel differently, I can probably add some sort of 'Saved' indicator. (So far as I can see, we don't have anything like this elsewhere in CBOX-OL, so I didn't have any prior art.) Moving to a system with an explicit Save button is probably not feasible at this moment, because there are multiple controls on this page that do not work together.

Here is a gif of the control:

Peek 2024-06-25 09-51

The settings supported are the same ones that BP offers by default, which are the same ones that CBOX-OL uses. Changing these (how they're named, ordered, etc) is out of scope for the current ticket.

I've done some testing of the avatar privacy protection itself, and it seems to be working in various parts of the CBOX-OL interface. But avatar generation in BuddyPress is complicated, and so various combinations must be tested. Some aspects to consider:

bree-z commented 2 months ago

Thanks Boone!

I've made it save via AJAX. I added some subtle opacity changes to indicate that saving is taking place. IMO this is fairly clear, but if others feel differently, I can probably add some sort of 'Saved' indicator.

This seems fine to me, but I'll check in with Charlie.

This was a beast to test, but I think I covered everything for uploaded avatars and for Gravatar as fallback:

Uploaded avatars were visible or not in each of these areas, as expected for the four different settings. The only thing I couldn't test was the Messages dropdown, because of a bug (I'll put in a separate ticket).

Gravatars were not visible where they weren't supposed to be, based on the different settings. However, there were a bunch of places they didn't appear at all no matter the settings, so I'm not 100% sure whether the settings correctly determined visibility in these places:

Sorting out where Gravatars should appear may be beyond the scope of this ticket, but I can at least be sure that they don't appear where they're not supposed to.

bree-z commented 2 months ago

I forgot to add one more thing:

When I view a user profile (my own or another user) without an uploaded avatar, I don't see the default CBOX OL avatar. Instead, I see this:

Screenshot 2024-07-11 at 4 14 06 PM

This avatar also appears on the homepage login box after logging in, and in site posts. The default avatar appears correctly in other places through the site.

Below is a user profile on openlab.sps.cuny.edu:

Screenshot 2024-07-11 at 4 18 59 PM
boonebgorges commented 2 months ago

Avatar treatment throughout the system is very complicated and hard to keep track of. I've just pushed up some changes that seem to make it more consistent. These changes shouldn't affect the visibility aspect of avatars, but they should be tested against different avatar states: no avatar with Gravatar fallback, no avatar without Gravatar fallback (default image), user-uploaded avatar.

bree-z commented 2 months ago

Thanks Boone! Avatars appear correctly for the different avatar states. I also did a little more visibility testing and didn't see any issues.