ChessCom / browser-extension

Customize your Chess.com experience
Other
48 stars 15 forks source link

Todo: Delete broken calcOnV3 function #81

Closed emilgoldsmith closed 7 years ago

emilgoldsmith commented 7 years ago

Here is the code.

While reading through codebase for greater understanding / purpose also for refactoring a bit, I just thought I'd test this, and it simply didn't work, https://www.chess.com/callback/user/popup/chesscom still returns with status code 200 (and if you go there in your browser you also see the data whether on V2 or not). Which resulted in me when trying to test the edge case being directed to /login which in turn doesn't log me in the extension since window.context.user isn't set on V2, but only V3, I'm assuming?

I don't know if there's any other good way to check it? I of course don't know the backend workings of Chess.com but I'm assuming you save the version with cookies? I can see there are different behaviours at /switch, if on V3 I get the redirection to / with a "Did you want to switch back to the old Chess.com?" red bar at the top, while when I'm on V2 it does the switch. I don't know if that can be detected.

Any other ideas?

martynchamberlin commented 7 years ago

V2 at this point is used by a very small minority and it's going to be completely gone in another few months at the latest. Let's not worry about this.

emilgoldsmith commented 7 years ago

Okay sure.

So just so I understand completely: If a new user with no cookies logs in on Chess.com, it will automatically go to V3? It's only if someone specifically chooses they want to use V2 that they do that yeah? (by testing myself in incognito it looks like that is indeed the behaviour). In that case yeah I'm also completely okay with that. I can submit a PR where I remove this function and alter all future calls to this function so we leave out redundant code (as you can obviously see that's one of my crusades haha)

martynchamberlin commented 7 years ago

Correct. V3 is default.

emilgoldsmith commented 7 years ago

Okay, so since this is broken anyway, let's just delete it?

martynchamberlin commented 7 years ago

Sure!