panoptes
panoptes copied to clipboard
Add user field for project team email communication
Ideally, once a user becomes a project owner, collaborator, or moderator they’d be included in an email list for project teams. A user could opt out from the project team email list from their user email settings, similar to other email communication preferences.
I think an initial question is if it’s ok to automatically include a user in an email list? If we’d prefer a user opts in, then this request is for a new user field similar to beta_email_communication
, maybe project_team_email_communication
, and the following is not relevant. On the frontend, the checkbox to toggle the field would only be shown if apiClient.type('projects').get({ current_user_roles: ['owner', 'collaborator', 'moderator'], page_size: 1 })
returned results.
If we’re ok with the automatic inclusion in the project team email list, I’m not sure what the edits to the user resource should be. Also, the related email list configuration (https://lists.zooniverse.org/cgi-bin/mailman/admin ?) is integral to this discussion.
Not exclusively, or in any particular order, solutions could include:
A. new user field, boolean, maybe project_team_email_opt_out
- defaults to
false
, if opt-out set totrue
- the project team email list query would include something like
user.project_team_email_opt_out=false
and user role including owner, collaborator, or moderator (Note 1)
B. new user field, support 3 states, maybe project_team_email_status
- defaults ‘ineligible’ or 0, on owner/collab/mod role creation set to ‘subscribed’ or 1, if opt out set to ‘unsubscribed’ or 2
- the project team email list query I think would be
user.project_team_email_status='subscribed'
C. 2 new user fields, both boolean, one if owner/collab/mod, one for project team email communication preference
- both default to
false
, on owner/collab/mod role creation both set totrue
, if opt out then communication preference field set tofalse
- the project team email list query would be for both fields equal to
true
Note 1 - current query to create the owner/collab/mod list manually that shows how eligibility via project roles can be determined:
SELECT DISTINCT(u.email)
FROM users u
INNER JOIN memberships ON memberships.user_id = u.id
INNER JOIN user_groups ON user_groups.id = memberships.user_group_id
INNER JOIN access_control_lists acl ON acl.user_group_id = user_groups.id
INNER JOIN projects ON projects.id = acl.resource_id
INNER JOIN user_project_preferences ON user_project_preferences.user_id = u.id
WHERE user_project_preferences.email_communication = true
AND user_project_preferences.project_id = projects.id
AND ('owner' = ANY (acl.roles) or 'collaborator' = ANY (acl.roles) or 'moderator' = ANY (acl.roles))
AND acl.resource_type = 'Project'
AND projects.live = true
AND projects.launch_approved = true
AND projects.state is null
order by email asc;
Mentioning @lcjohnso , @srallen , @camallen , @adammcmaster - though no rush to, or required, response