scratchfoundation / scratch-www

Standalone web client for Scratch
https://scratch.mit.edu
BSD 3-Clause "New" or "Revised" License
1.59k stars 841 forks source link

CE-324 Add Clearer Error message on comment when logged out #4116

Open GrahamSH-LLK opened 4 years ago

GrahamSH-LLK commented 4 years ago

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

Explosion-Scratch commented 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."

GrahamSH-LLK commented 4 years ago

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: image We could also add a reload button. @explosion-scratch

GrahamSH-LLK commented 4 years ago

Ie. Something like this: image 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>

BoomerScratch commented 4 years ago

@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?

apple502j commented 4 years ago

It's actually possible to automatically copy it to clipboard - but let's wait for the devs :P

BoomerScratch commented 4 years ago

@apple502j I know, but people might have other clipboard data, which will get overwritten. I guess adding a button is the best.

GrahamSH-LLK commented 4 years ago

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

BoomerScratch commented 4 years ago

@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.

GrahamSH-LLK commented 4 years ago

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> image The code doesn't work yet though.

BoomerScratch commented 4 years ago

@GrahamSH-LLK Yes - that's better.

benjiwheeler commented 4 years ago

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.

Explosion-Scratch commented 4 years ago

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

BoomerScratch commented 4 years ago

@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.

GrahamSH-LLK commented 4 years ago

@BoomerScratch @benjiwheeler Would that work?

benjiwheeler commented 3 years ago

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.