-
Notifications
You must be signed in to change notification settings - Fork 75
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
Edit workflow request when queried depending on role or project setting #3648
Conversation
On staging: On production (https://test-workflow-fix.pfe-preview.zooniverse.org/projects/zooniverse/notes-from-nature/classify?env=production&workflow=3758): |
if @props.location.query?.workflow? and @checkUserRoles(project, @props.user) | ||
selectedWorkflowID = @props.location.query.workflow | ||
activeFilter = false | ||
unless preferences?.preferences.selected_workflow is selectedWorkflowID |
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.
Ideally wouldn't update user workflow preference if accessing workflow vie workflow query and admin/owner/collab, but if I remove this I think an infinite loop is triggered in componentWillUpdate
because the preferences don't match, that keeps requesting the same workflow from API.
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.
I think we still want this behavior even if admin/owner/collab because that user might just be wanting to classify on their own project and storing the workflow id in the prefs means it'll load up the correctly selected workflow if they browse between talk and back, etc. If they revisit w/o the query param for the workflow, the behavior will clear out the workflow from their prefs if inactive.
I'm not seeing an issue with the workflow query param for a project that I'm a collab on in production. What's the specific error you're seeing? |
app/pages/project/index.cjsx
Outdated
@@ -230,7 +240,7 @@ ProjectPageController = React.createClass | |||
|
|||
checkUserRoles: (project, user) -> | |||
currentUserRoleSets = @state.projectRoles.filter((roleSet) => roleSet.links.owner.id is user.id) |
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.
This line will still need an existential check on the user: user?.id
. Trying the workflow query param when logged out is broken otherwise.
Just as a collaborator when I try https://test-workflow-fix.pfe-preview.zooniverse.org/projects/zooniverse/notes-from-nature/classify?env=production&workflow=3758 it goes through the second I tried (Test Workflow button on inactive workflow as a collaborator) on a different production project and it did work though, so it must be NfN related, though not sure it's due to related project setting or size of NfN. |
Turns out it was that there are more than 20, the default |
should we just allow filtering of the project roles with the user_id instead of fetching pages of data and looking through it? Possibly related to zooniverse/panoptes#1575 |
Removed unnecessary If @camallen - let me know if I've misinterpreted, but I think this addresses your comment? |
I plan to add a conditional to check if user is defined before even requesting projectRoles, so if there's no user the request is never made, and see how that works, or if there are any other requests that could be refactored similarly, but unsure if that will work, thinking about it from memory not actually looking at the code at the moment. |
@mcbouslog having the project roles in the project controller state is useful whether there is a logged in user or not. My intention of requesting it as an include with the project was to eventually eliminate a few places where it is redundantly called on other project pages, such as the team listing on the about pages. Most projects probably don't have more than 20 roles on them. NfN is again probably unique in this. Increasing the page size is a sufficient interim fix. We can refactor once improvements are made, like querying with user id or project role name to determine if the logged in user is a collab. |
@srallen - makes sense and sounds good to me, I added back the I'm sure intentional, but thought I'd note the |
Understood @srallen - page_size limit increase works (for a while) if you need the resources elsewhere. The lab page could access check could use the specific filter query for the logged in user but that can come later. |
…ng (#3648) * add activeFilter, separate workflow query by role vs project setting * edit project_roles request page_size * remove page_size increase * edit project_roles request - increase page_size, remove user_id
Temporary Alternative: see branch
disable-test-workflow
Fixes broken Test Workflow button from workflow editor in lab.
If a workflow query in url and admin/owner/collaborator remove
active: true
from workflow request to allow viewing of inactive workflow, i.e. via Test Workflow button from lab.If a workflow query in url and project settings allow workflow queries, try to get requested workflow, but if inactive then remove query and proceed through other workflow determining steps.
Review Checklist
rm -rf node_modules/ && npm install
and app works as expected?Optional
ChangeListener
orPromiseRenderer
components with code that updates component state?