Open GrahamSH-LLK opened 4 years ago
So are you proposing thbat it says something more specific? Like "Oop! You have been logged out! To prevent lost work your comment was copied to the clipboard."
Yeah! I think something like "Oops! You have been logged out! To prevent lost work your comment was copied to the clipboard. Please reload to sign back in!" It would look like this: We could also add a reload button. @explosion-scratch
Ie. Something like this:
by changing <span>Oops! Something went wrong posting your comment</span>
to <span>Oops! You have been logged out! To prevent lost work your comment was copied to the clipboard. Please reload to sign back in! <a href="javascript:location.reload()"> Reload</a></span>
@GrahamSH-LLK I guess
<span>Oops! You have been logged out! Please copy the comment to your clipboard to not lose your work. <a href="javascript:location.reload()">Reload</a> to refresh your session.</span>
is better?
It's actually possible to automatically copy it to clipboard - but let's wait for the devs :P
@apple502j I know, but people might have other clipboard data, which will get overwritten. I guess adding a button is the best.
Perhaps <span>Oops! You have been logged out! To prevent lost work your comment was copied to the clipboard. Please <a href="javascript:location.reload()"> reload</a> and sign back in! </span>
@GrahamSH-LLK https://github.com/LLK/scratch-www/issues/4116#issuecomment-646027571 I think it's best not to automatically copy the comment to the clipboard - a button instead would be much better.
Ok! Maybe something like this: <span>Oops! You have been logged out! To prevent lost you can <a href="javascript:(function()%7Bvar%20copyText%20%3D%20document.getElementById(%22frc-compose-comment-3392903%22)%3BcopyText.select()%3BcopyText.setSelectionRange(0%2C%2099999)document.execCommand(%22copy%22)%7D)()"> copy</a> your comment to the clipboard. Please <a href="javascript:location.reload()"> reload</a> and sign back in! </span>
The code doesn't work yet though.
@GrahamSH-LLK Yes - that's better.
This would be good! And, it's currently a bit tricky to tell that you've been logged out -- we may need to do some work to make that easier to detect.
This sounds good but would'nt this change it fo every error? As benjiwheeler said, we would need to implement some sort of detection system in this case
@benjiwheeler Yes, it requires API changes. Else we can send a request to the session (https://scratch.mit.edu/session); the response will be
{
}
when logged out.
@BoomerScratch @benjiwheeler Would that work?
Something in that direction would work -- but since this connects to https://github.com/LLK/scratch-www/issues/2970, which is a big and complex issue, I think we should wait until we address that to address this one. I made a note on #2970 to mention this issue.
If you get logged out automatically during writing a comment, it gives a generic error message. (Oops! Something went wrong posting your comment) It even looks like you are still logged in. You have to reload to find out that you are logged out, and your comment is lost. (Unless you copied it)
Steps to Reproduce
Go to a project Duplicate the tab Start Writing a comment Log Out in the other one Go back to the other See error message This also happens when you are logged out automatically to save server usage.
Operating System and Browser
ChromeOS Chrome