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 Intent.ensureProfile #318

Merged
merged 2 commits into from
Mar 25, 2021
Merged

Add Intent.ensureProfile #318

merged 2 commits into from
Mar 25, 2021

Conversation

Half-Shot
Copy link
Contributor

A quick helper function which bridges can call on the bot after startup to check the correct profile info is set.

@Half-Shot Half-Shot requested a review from a team March 23, 2021 18:54
* @param displayname The displayname to set. Leave undefined to ignore.
* @param avatarUrl The avatar to set. Leave undefined to ignore.
*/
public async ensureProfile(displayname?: string, avatarUrl?: string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be a bit too much of an edge case:
How to ensure the display name or avatarUrl is unset?

Falsy values will get ignored or cause the function to throw.

Copy link
Contributor Author

@Half-Shot Half-Shot Mar 24, 2021

Choose a reason for hiding this comment

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

Hmm, good question. In fairness the spec doesn't actually give you a way to unset a profile https://spec.matrix.org/unstable/client-server-api/#profiles so it's always been a bit troublesome. I'd probably say for now that the bridge should explicitly unset a profile key if they want to remove it rather than calling this function.

It's also fairly edge-casey

Copy link
Contributor

@jaller94 jaller94 left a comment

Choose a reason for hiding this comment

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

Looks good to me.
I recognise that unsetting (or setting an empty string) is an edge case that is also not defined in the spec.

@Half-Shot Half-Shot merged commit 6831acc into develop Mar 25, 2021
@Half-Shot Half-Shot deleted the hs/ensure-profile branch May 2, 2023 16:05
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.

2 participants