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

Add possibility to hide user's and opponent's ratings ONLY when playing #16228

Merged
merged 57 commits into from
Dec 18, 2024

Conversation

yahya-lafhal
Copy link
Contributor

@yahya-lafhal yahya-lafhal commented Oct 15, 2024

Resolves #15632

I added a new game behavior preference that lets the user decide whether to show or not his rating and his opponent's rating while he is in game. Once the game is ended, the ratings are showed again. This lets users have both the possibility to see ratings throughout the website (analysis, watching games, challenges, profiles, ...) and the possibility to focus while playing without seeing and thinking of the ratings.

What can be added : Translations for other languages for the new preference

Copy link
Member

@trevorbayless trevorbayless left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked out the PR and tested the changes. Below are some findings I wanted to capture for notice and consideration for you and other reviewers.

  • If this preference is enabled and and you are sent a challenge, the rating is still displayed on the challenge popup which spoils the opponents rating before possibly accepting:
    Screenshot_20241017_130629

  • Same issue as above but on the "Play with a friend" challenge link:
    Screenshot_20241017_133219

  • There is a placeholder gap on the powertip popup which shows user ratings which I recommend cleaning up (the existing hide ratings feature already does this, so I recommend looking at how it does that):
    Screenshot_20241017_130809
    Screenshot_20241017_130740

  • This new setting "Show player ratings while playing your games" is similar to the existing setting "Show player ratings" but it's under a different preference screen ("Preferences -> Game Behavior" vs "Preferences -> Display").

  • To me, it would make sense for these two rating settings to be combined (how Zen mode is) since you will only ever have one of these settings activated at a given time:
    Screenshot_20241017_131545
    image
    example:
    image

@yahya-lafhal
Copy link
Contributor Author

Totally right thanks for the review, I will work on these changes when I have time :)

I'm just not sure if the challenges and "Play with a friend" can confuse users because they are not in-game yet so I don't really know if we should or not hide the ratings there.

@yahya-lafhal yahya-lafhal marked this pull request as draft October 22, 2024 02:10
@ornicar
Copy link
Collaborator

ornicar commented Oct 24, 2024

ratings are still visible when hovering the crosstable games
image

@ornicar
Copy link
Collaborator

ornicar commented Oct 24, 2024

all user tooltips have a large unused space when using the new setting
image

@yahya-lafhal
Copy link
Contributor Author

yahya-lafhal commented Oct 24, 2024

For the user tooltips space problem, it is when checking one outside of the game page, so most likely not the opponent's one. Should I fix the space or let the user see the ratings on the user tooltips of users that are not him or his current opponent while he is in game ? I am still not sure what ratings we should and shouldn't hide for this feature.

Same thing for the crosstable games, it's old games and old ratings, knowing that we already show the opponent rating once the game ends, should I hide it or let it ?

@ornicar
Copy link
Collaborator

ornicar commented Oct 25, 2024

  1. I think we should be able to see all ratings normally outside of the current game page.
  2. The crosstable games are on the current game page, so they shouldn't reveal ratings.

@yahya-lafhal
Copy link
Contributor Author

Perfect, I'll work on it !

@yahya-lafhal
Copy link
Contributor Author

I made the crosstable games not reveal the ratings anymore. It works fine now. But I'm struggling a bit with showing the ratings outside the current game page. It hides the ratings in two places : the users minis and the games minis. So if you are currently in game, even if you leave the game page, you are not able to check another user's rating via his mini (in the homepage etc). I don't really know how to make it depend on the current page. I thought about the "playing" or "no-rating" classes that are set on the html body, but I think it's a weird approach. And even with that, it doesn't remove the classes in the game page directly after ending, it requires a refresh. Let me know if you have an idea or opinion about how to deal with this.

@ornicar
Copy link
Collaborator

ornicar commented Nov 6, 2024

I see that the current implementation relies on env.round.playing. This only works for realtime games; not for correspondence games.
Indeed we can't consider that someone is currently playing, just because they have an ongoing correspondence game, which can last months.

As a result I think the current implementation cannot work.

Instead it should probably rely on CSS-only tweaks, using the body.playing.no-rating selector.

@yahya-lafhal
Copy link
Contributor Author

Back to this after my exams haha. So as discussed, I replaced the logic relying on env.round.playing with a css logic around the no-rating body class. It works great as expected. The only thing is that after ending a game, it doesn't show the rating directly, the user has to either refresh or go to another page like the review etc. But I think it makes sense in case the user wants to rematch without seeing the opponent rating. So to me it's even better. Let me know if I should change or add anything.

@yahya-lafhal yahya-lafhal requested a review from ornicar December 17, 2024 17:21
@ornicar
Copy link
Collaborator

ornicar commented Dec 18, 2024

Nice and simple, I like it

@ornicar ornicar merged commit 12a889e into lichess-org:master Dec 18, 2024
6 checks passed
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.

Feature Request: Hide rating during game, but show it when game is finished
3 participants