Update frontend to wait for "Publish Draft" to complete#5144
Update frontend to wait for "Publish Draft" to complete#5144rtibbles merged 9 commits intolearningequality:unstablefrom
Conversation
contentcuration/contentcuration/frontend/shared/data/resources.js
Outdated
Show resolved
Hide resolved
| @@ -639,26 +641,44 @@ def publish_next(self, pk): | |||
| progress_tracker=progress_tracker, | |||
There was a problem hiding this comment.
@rtibbles Just noticed that we are not creating any change event when we set the publishing field to true. This means that this change won't sync between parallel users, is that okay? (I know this is less relevant for the staging tree publishing as it is usually just one chef checking this page at a time 😅, but just checking-in)
There was a problem hiding this comment.
For my understanding, "we are not creating any change event when we set the publishing field to true" -> looks like both publish and publish_next are missing this, is that right? Or maybe I'm missing something.
There was a problem hiding this comment.
For my understanding, "we are not creating any change event when we set the publishing field to true" -> looks like both publish and publish_next are missing this, is that right? Or maybe I'm missing something.
Yes! Both of them are missing this.
There was a problem hiding this comment.
I think the main reason we don't, is that adding a new change event after a publish then means that the channel can then be republished (because it now has changes). In all honesty, I am now sketchy on the details, and I am not confident that the current implementation is handling this correctly - but the fact that there is a pending Published or DraftPublished event should be sufficient for flagging this in the frontend for all users.
As such, I wonder if the correct query to do here should be on the changes table, rather than the channel table, and checking to see if there are any draft published changes that have been applied yet or not?
There was a problem hiding this comment.
Yeah I agree checking the changes table is more direct and cleaner than relying on some field updates on the channel table. Updated.
contentcuration/contentcuration/frontend/shared/data/resources.js
Outdated
Show resolved
Hide resolved
contentcuration/contentcuration/frontend/shared/data/resources.js
Outdated
Show resolved
Hide resolved
|
Interested in both your thoughts @taoerman and @AlexVelezLl about using the changes more proactive to monitor for finishing of the publish, rather than relying on changing attributes on the channel itself. |
This sounds great, it's cleaner to check the changes table directly. The current sync will delete a change locally if applied, I updated the live query accordingly. PLTA. Thanks! |
|
Thanks @taoerman, I'll take another look! |
Summary
Similar to the deployment flow, show a spinner when draft publishing is in progress. When it completes, show the popup.
Spinner screenshot:

Popup screenshot:

References
#5115
Reviewer guidance
Run server locally, make sure celery is on. Upload a staging channel using ricecooker script. Then test "Publish Draft" button.
To test a failure case, update this publish_next function to always throw an error and test in the UI.