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

Allow passing impersonated device ID to Intent #46

Closed

Conversation

jaywink
Copy link
Member

@jaywink jaywink commented Jul 24, 2024

When creating an impersonating client for an appservice, allow passing in a device ID to use. This will make the requests have org.matrix.msc3202.device_id in the query string for the client requests.

Signed-off-by: Jason Robinson jasonr@element.io

Checklist

  • Tests written for all new code
  • Linter has been satisfied
  • Sign-off given on the changes (see CONTRIBUTING.md)

When creating an impersonating client for an appservice, allow passing in a device ID to use. This will make the requests have `org.matrix.msc3202.device_id` in the query string for the client requests.
@jaywink jaywink marked this pull request as draft July 24, 2024 12:00
@jaywink jaywink marked this pull request as ready for review July 24, 2024 12:39
Copy link
Member

@Half-Shot Half-Shot left a comment

Choose a reason for hiding this comment

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

Seems like a reasonable improvement, added a typing note.

/**
* Gets the device ID this intent is for.
*/
public get deviceId(): string {
Copy link
Member

Choose a reason for hiding this comment

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

May be undefined?

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated!

When creating an impersonating client for an appservice, allow passing in a device ID to use. This will make the requests have `org.matrix.msc3202.device_id` in the query string for the client requests.

Appservice `intentsConfig` can be provided with a `botDeviceId`, which will be passed into creating the `Intent` for the bot user only.
@jaywink jaywink force-pushed the jaywink/impersonating-intent-devices branch from 3230ab4 to 2a4f9ce Compare July 25, 2024 11:02
Copy link
Member

@Half-Shot Half-Shot left a comment

Choose a reason for hiding this comment

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

One type change and you're good.

/**
* Get the application service's "bot" user device ID.
*/
public get botDeviceId(): string {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
public get botDeviceId(): string {
public get botDeviceId(): string|undefined {

This still doesn't return just a string :)

@jaywink
Copy link
Member Author

jaywink commented Aug 15, 2024

This was not required after all, so closing to avoid adding unnecessary code with no proven use cases.

@jaywink jaywink closed this Aug 15, 2024
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