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

fix(autocomplete): Fix missing user status on autocomplete endpoint #40660

Conversation

nickvergessen
Copy link
Member

  • Discovered by @Antreesy when working with participant suggestions in Talk

Summary

Regression from 1be8362#diff-8a51ce62a02e28659acaa3f84252600107a22d2eb093d950f2c9c16fe6b96c8e
It seems the "empty string" default had confused @provokateurin but the status value was actually always an array, as per:

$status = [
'status' => $userStatus->getStatus(),
'message' => $userStatus->getMessage(),
'icon' => $userStatus->getIcon(),
'clearAt' => $userStatus->getClearAt()
? (int)$userStatus->getClearAt()->format('U')
: null,
];

I now added an integration test to confirm it's working and stays working. I left the default/empty value untouched as empty string and basically restored the array data when a status is present.

Checklist

@provokateurin
Copy link
Member

So it can be a string that is just the same object in JSON? I still can't make sense of this API

@nickvergessen
Copy link
Member Author

So it can be a string that is just the same object in JSON? I still can't make sense of this API

No, it's a empty-string or an array as per OpenAPI doc block.

The JSON object is just used in Integration tests, because Behat can not handle nested arrays in TableNodes, so I json-encode the status array there

@provokateurin
Copy link
Member

I see, but why the empty string instead of just null? This makes the API way more complex than it needs to be (although this is probably just for historical reasons).

@nickvergessen
Copy link
Member Author

I see, but why the empty string instead of just null?

Because it was empty string since adding the values back in 2021 and yes I might have made a mistake there. But now clients could rely on it.

This makes the API way more complex than it needs to be (although this is probably just for historical reasons).

🤷🏼

Copy link
Contributor

@Antreesy Antreesy left a comment

Choose a reason for hiding this comment

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

tested against Talk app:

B A
Screenshot from 2023-09-27 17-10-53 Screenshot from 2023-09-27 17-09-55

Signed-off-by: Joas Schilling <coding@schilljs.com>
@nickvergessen nickvergessen force-pushed the bugfix/noid/fix-missing-user-status-on-autocomplete-api branch from 0e5fdbd to a7018bc Compare September 28, 2023 12:02
@nickvergessen nickvergessen merged commit c88b02a into master Oct 4, 2023
35 of 38 checks passed
@nickvergessen nickvergessen deleted the bugfix/noid/fix-missing-user-status-on-autocomplete-api branch October 4, 2023 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants