-
Notifications
You must be signed in to change notification settings - Fork 12
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
RDISCROWD-5412 Search contacts against coowners, subadmin, admin. #776
Conversation
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.
looks like the unit test failed due to the change.
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.
Could you fix the unit test?
pybossa/view/projects.py
Outdated
|
||
if form.contact and form.contact.data.lower() == 'true': | ||
# Filter contacts only to users that are enabled and assigned to this project or are sub-admin/admin. | ||
users = [user for user in users if is_user_enabled_assigned_project(user, project) or user.id in project.owners_ids] |
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.
IMO, only users that are part of project.owners_ids
to be contacted and admins/subadmins not part of project.owners_ids
need not be considered.
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.
Also, user in contact list when removed from owners_ids
should also be removed from contacts
list
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.
To keep this PR simple, perhaps we should allow the user to manage the lists independently. That is, after removing a co-owner, they would also need to remove the contact as well (two clicks), followed by saving.
Otherwise, if we choose to keep the contacts and co-owners synchronized, it may require modifying the Vue component to react to the 'X' button on both lists in the UI, in addition to including the filter in the server-side code. Perhaps, this could be postponed to a future ticket?
This would help keep the scope of the work involved in this PR contained. Thoughts?
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.
yes, having future ticket to handle follow up work to synchronize contacts with co-owners is fine. thanks!
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.
Filter contacts in search to only coowners. Added unit tests.
Pull Request Test Coverage Report for Build 3083355893
💛 - Coveralls |
pybossa/view/projects.py
Outdated
for user in users: | ||
if user.id in project.owners_ids: | ||
filtered_list.append(user) | ||
users = filtered_list |
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.
If you prefer, line 3201 to 3205 can be rewrite with list comprehension.
users = [user for user in users if user.id in project.owners_ids]
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.
Fixed via c8440d7
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.
lgtm, thank you.
Screenshots
Re: bloomberg/pybossa-default-theme#376