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

Display up-to-date online status in user panels #31524

Merged
merged 17 commits into from
Feb 5, 2025

Conversation

smoogipoo
Copy link
Contributor

@smoogipoo smoogipoo commented Jan 15, 2025

Resolves #13604

Prereqs:

I've chosen to ignore APIUser.IsOnline because it's potentially going to be out-of-date with the model cached in UserLookupCache. We're eventually going to have a MetadataClient.RequestPresenceUpdate(user) to keep it up-to-date, but this is fine for now because I can't find these panels actually displayed anywhere else.

Preview (ignore error at the end -- nondescript segfault on random thread...):

2025-01-15.16-49-35.mp4

@smoogipoo smoogipoo added the notable feature Attach to pull requests which should be highlighted on the changelog. Things users want to read. label Jan 16, 2025
Comment on lines 99 to 102
if (User.Equals(api?.LocalUser.Value))
presence = new UserPresence { Status = api.Status.Value, Activity = api.Activity.Value };
else
presence = metadata?.GetPresence(User.OnlineID);
Copy link
Member

Choose a reason for hiding this comment

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

Would you be against this following the standard server flow rather than a special case for the local user?

ie. Make it so the metadata server will always send the local user's presence updates back to them so they know when it's applied on the server side? personally i think this will feel better (i'd expect my own user card to update based on when the status is ack'd, rather than when applied).

@peppy peppy self-requested a review January 17, 2025 08:28
@peppy
Copy link
Member

peppy commented Jan 17, 2025

We're going to need to do something about the spectator scenario, this looks weird:

osu! 2025-01-17 at 08 45 27

  • Have the client request all presence updates when at the spectator screen (easiest option)
  • Have a flow to allow the client to request watching specific users' presence (probably unnecessary for now)
  • Combine MetadataHub and SpectatorHub so we osu-server-spectator can send presence implicitly when a user is spectating another (unless there's other things which require this, maybe best left for a rainy day)

@@ -120,7 +118,7 @@ protected override void OnFocus(FocusEvent e)
searchTextBox.TakeFocus();
}

private void onUserPresenceUpdated(object sender, NotifyDictionaryChangedEventArgs<int, UserPresence> e) => Schedule(() =>
private void onUserPresenceUpdated(object? sender, NotifyDictionaryChangedEventArgs<int, UserPresence> e) => Schedule(() =>
Copy link
Member

Choose a reason for hiding this comment

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

With the recent changes to split out local user state, this is now missing self (you can no longer see your own panel on the online display). This can be fixed by decoupling the local list and inserting self, but I'm thinking maybe it makes more sense to keep self in the all-presences list? Interested in opinions on this one @ppy/team-client.

Copy link
Collaborator

@bdach bdach Jan 17, 2025

Choose a reason for hiding this comment

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

I have a vague unsubstantiated recollection that when I worked on the user presence code I initially excluded self from the online display list, and then you added it back, but I'm not sure if that even really happened, I couldn't find any evidence of it on a few searches.

I'm relatively ambivalent on showing own panel. I don't think showing self brings any value, but also doesn't really seem to have any real downside, so I'm not sure I have a formed opinion at the end of the day. Maybe if there is some compelling argument to show or not show I could change my stance, I don't really see one for either option.

Copy link
Member

@peppy peppy Feb 3, 2025

Choose a reason for hiding this comment

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

@bdach Was this resolved by a server-side change? Is this PR ready for a second round of review?

Edit: I think ppy/osu-server-spectator#259 actually resolved the spectator issues i pointed out above..?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Not to my knowledge. In this particular conversation I was attempting to chip in on whether being able to see self on this display was relevant or not.

The backlink here from my PR was ppy/osu-server-spectator#259 (comment), which has nothing to do with this particular review thread (but in general is relevant to this PR, namely the concern in #31524 (comment)).

The lack of any response to either point was why I didn't attempt picking up reviewing this any further because these look like valid concerns to me.

Copy link
Member

Choose a reason for hiding this comment

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

Never mind, both issues are still present.

@peppy
Copy link
Member

peppy commented Feb 3, 2025

Current state of this PR, two concerns remain:

  • Spectator screen shows spectating user as offline if they are not a friend (needs to be resolved)
  • Own user card is no longer displayed (can be fixed at a later point as it seems this is also not happening on latest release)

@smoogipoo shall i look at fixing the spectator case or did you want to?

@pull-request-size pull-request-size bot added size/XL and removed size/L labels Feb 4, 2025
Copy link
Member

@peppy peppy left a comment

Choose a reason for hiding this comment

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

Seems to be working well enough now, time will tell 😄

@peppy peppy merged commit ea725e2 into ppy:master Feb 5, 2025
8 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:overlay-dashboard notable feature Attach to pull requests which should be highlighted on the changelog. Things users want to read. size/XL type:online
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Friends' online status doesn't update ever
3 participants