Skip to content

Fix duplicate service ID#306

Merged
mpgxvii merged 12 commits intodevfrom
fix_duplicate_service_id
Oct 3, 2025
Merged

Fix duplicate service ID#306
mpgxvii merged 12 commits intodevfrom
fix_duplicate_service_id

Conversation

@yatharthranjan
Copy link
Member

Attempts to fix #305

@yatharthranjan yatharthranjan changed the title Fix duplicate service Fix duplicate service ID Jul 22, 2025
@yatharthranjan yatharthranjan changed the title Fix duplicate service ID Fix duplicate service ID #305 Jul 22, 2025
@yatharthranjan yatharthranjan changed the title Fix duplicate service ID #305 Fix duplicate service ID Jul 22, 2025
@pvannierop
Copy link
Contributor

@yatharthranjan The solution looks good. Did you test it? Should I test it as well?

mpgxvii
mpgxvii previously approved these changes Jul 30, 2025
Copy link
Member

@mpgxvii mpgxvii left a comment

Choose a reason for hiding this comment

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

LGTM!

@yatharthranjan
Copy link
Member Author

@pvannierop I have not tested this yet. would be great if you can test it. Thanks.

Also, wonder if we should only do this check if the other existing user is authorized=true and hasValidToken()

@yatharthranjan yatharthranjan marked this pull request as draft September 1, 2025 15:00
@mpgxvii mpgxvii marked this pull request as ready for review September 1, 2025 17:54
@mpgxvii mpgxvii requested a review from this-Aditya September 26, 2025 15:22
Copy link
Member

@this-Aditya this-Aditya left a comment

Choose a reason for hiding this comment

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

Hi @yatharthranjan, kindly review the comments inline, the pr seems fine otherwise.

* Should be called before updating a user's token with an external user ID.
*/
private suspend fun validateExternalUserId(token: RestOauth2AccessToken?, user: RestSourceUser) {
if (token?.externalUserId != null) {
Copy link
Member

Choose a reason for hiding this comment

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

Should we add an else block to handle when externalUserId is null?

Copy link
Member

Choose a reason for hiding this comment

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

Added now 👍

) = asyncService.runAsCoroutine(asyncResponse) {
val registration = registrationService.ensureRegistration(token)
val accessToken = authorizationService.requestAccessToken(payload, registration.user.sourceType)
val user = userRepository.updateToken(accessToken, registration.user)
Copy link
Member

Choose a reason for hiding this comment

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

Since we are replacing userRepository::updateToken, the variable userRepository is now unused and can be removed

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for reviewing this. Removed now.

Copy link
Member

@this-Aditya this-Aditya left a comment

Choose a reason for hiding this comment

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

LGTM, Thanks

@this-Aditya
Copy link
Member

Should I merge this, or is there any work left?

@mpgxvii
Copy link
Member

mpgxvii commented Oct 3, 2025

Should I merge this, or is there any work left?

Yes I think we can merge.

@mpgxvii mpgxvii merged commit 91f7c01 into dev Oct 3, 2025
7 of 8 checks passed
@mpgxvii mpgxvii deleted the fix_duplicate_service_id branch October 3, 2025 11:22
@mpgxvii mpgxvii mentioned this pull request Oct 3, 2025
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.

4 participants