-
Notifications
You must be signed in to change notification settings - Fork 95
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
Lock documents in a bad state #182
Conversation
…/lock-docs-in-a-bad-state
} | ||
// Don't continue if document is locked. | ||
if locked { | ||
http.Error(w, "Document is locked", http.StatusLocked) |
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.
What happens in the frontend when we respond with this error? In some cases users may only notice that the document is locked when they change the state of the document. Do we have a good UX for them to identify what they should do to fix it? Can we point them to the sidebar where the locked message is shown?
cc: @jeffdaley
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.
Good questions! Currently this flash message will appear:
It's not an ideal UX, but is better than the current experience of when a doc gets into this state 🙂 We should probably at least handle this error in a way where the sidebar immediately changes to "locked mode" (this currently requires a browser refresh). As we discussed offline, we can handle these in a follow-up PR.
* Bad-state draft * Improve bad-state design * Allow query args when finding documents * Add locked boolean for documents * Handle locked documents in the indexer * Check if documents are locked for APIs that replace the doc header * Get document locked status in the frontend * Update locked document messaging * Fix 'ReferenceError: error is not defined' bug * Update property name to be consistent with backend --------- Co-authored-by: Jeff Daley <[email protected]>
Due to #181, we cannot refresh document headers when they contain a suggestion, so this PR locks documents in this state. The indexer will then always attempt to reindex locked documents on every run and unlock+reindex them if the suggestions in the header are removed. API calls that replace the document header have been updated to first check if the document is locked and will return a Locked HTTP status if this is the case.
For the frontend parts, this builds on @jeffdaley's work in #178 and updates the messaging a bit. Oh, and I couldn't take that
ReferenceError: error is not defined
message when requesting a review fails anymore, so I tracked that 🐛 down.Bottom of sidebar when a document is locked: