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

Make locking work across tabs #1

Open
wants to merge 1 commit into
base: v2
Choose a base branch
from
Open

Make locking work across tabs #1

wants to merge 1 commit into from

Conversation

AndrewGibson27
Copy link

@AndrewGibson27 AndrewGibson27 commented Oct 24, 2017

If we do this, we'll need to update our PyPI first. To test, do the following inside Docker in the texastribune repository:
pip install -e git://github.com/texastribune/django-locking@cross-tab#egg=locking

Then, test every locking scenario you can think of (fun, right?). At any point, you can put the following in your browser console to see the value(s) stored in local storage:
console.log(JSON.parse(localStorage.getItem('djangoLocking')));

When you're on a story form, it should show something like {17047: true}. When you're not, it should be an empty {} indicating the lock_pk is no longer in local storage.

Scenarios to test include:

  • When you're the only one in the story, and it's only open in one tab
  • When you have the story open in two tabs. The second one opened should have "locked by " in the lock button.
  • When you have the same story open in two browser windows. The second one opened should have "locked by " in the lock button.
  • Having the story open in one window, then logging in as a different user in an incognito window. The incognito window should have "locked by " in the lock button.
  • In the same scenario as the bullet above, try taking over the lock in the incognito window.
  • Try getting out of the story in all tabs/windows and doing the console.log() mentioned above. Confirm it shows an empty value.
  • In any/all of these scenarios, try switching into read-only mode.
  • In any/all of these scenarios, try saving edits and verifying nothing wonky happens.

And anything else that sounds relevant. TBH, I'd love never to deploy this because I'm sure there's some weird polling + read-only + override-something-or-other scenario I'm forgetting about. But hey, it's something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant