Skip to content
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

Merged
merged 11 commits into from
Jun 1, 2023
Merged

Lock documents in a bad state #182

merged 11 commits into from
Jun 1, 2023

Conversation

jfreda
Copy link
Contributor

@jfreda jfreda commented May 26, 2023

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:
image

@jfreda jfreda requested a review from a team as a code owner May 26, 2023 19:58
}
// Don't continue if document is locked.
if locked {
http.Error(w, "Document is locked", http.StatusLocked)
Copy link
Contributor

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

Copy link
Contributor Author

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:
image

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.

@jfreda jfreda merged commit e933830 into main Jun 1, 2023
@jfreda jfreda deleted the jfreda/lock-docs-in-a-bad-state branch June 1, 2023 19:03
anuragprafulla pushed a commit to razorpay/hermes that referenced this pull request Jun 27, 2023
* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants