-
Notifications
You must be signed in to change notification settings - Fork 63
FLOW-1758: Add attribute to track RDS/RDE paid or unpaid seat in feedback collector - (Rovo Dev) #1756
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
base: main
Are you sure you want to change the base?
FLOW-1758: Add attribute to track RDS/RDE paid or unpaid seat in feedback collector - (Rovo Dev) #1756
Changes from all commits
afaf418
ed2e143
efa9f62
2ccbdfb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,4 +1,5 @@ | ||||||||||
| import { truncate } from 'lodash'; | ||||||||||
| import { Container } from 'src/container'; | ||||||||||
| import { UserInfo } from 'src/rovo-dev/api/extensionApiTypes'; | ||||||||||
| import * as vscode from 'vscode'; | ||||||||||
|
|
||||||||||
|
|
@@ -23,7 +24,7 @@ export class RovoDevFeedbackManager { | |||||||||
| isBBY: boolean = false, | ||||||||||
| ): Promise<void> { | ||||||||||
| const transport = getAxiosInstance(); | ||||||||||
| const context = this.getContext(isBBY, feedback.rovoDevSessionId); | ||||||||||
| const context = await this.getContext(isBBY, feedback.rovoDevSessionId); | ||||||||||
|
|
||||||||||
| let userEmail = 'do-not-reply@atlassian.com'; | ||||||||||
| let userName = 'unknown'; | ||||||||||
|
|
@@ -97,13 +98,23 @@ export class RovoDevFeedbackManager { | |||||||||
| } | ||||||||||
| } | ||||||||||
|
|
||||||||||
| private static getContext(isBBY: boolean = false, rovoDevSessionId?: string): any { | ||||||||||
| private static async getContext(isBBY: boolean = false, rovoDevSessionId?: string): Promise<any> { | ||||||||||
| const extensionApi = new ExtensionApi(); | ||||||||||
|
|
||||||||||
| let entitlementType: string = 'unknown'; | ||||||||||
| try { | ||||||||||
| const entitlement = await Container.rovoDevEntitlementChecker.checkEntitlement(); | ||||||||||
| entitlementType = entitlement.type; | ||||||||||
| } catch { | ||||||||||
| entitlementType = 'unknown'; | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔎 Code ReadabilityThe variable assignment on line 109 is redundant since Details📖 Explanation: Removing the redundant assignment in the catch block would simplify the code since the variable is already initialized with the fallback value.
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔎 Code ReadabilityThe error handling in the catch block reassigns Details📖 Explanation: Removing the redundant assignment in the catch block simplifies the code since the variable is already initialized with the fallback value, making the error handling more concise.
Suggested change
|
||||||||||
| } | ||||||||||
|
|
||||||||||
| return { | ||||||||||
| component: isBBY ? 'Boysenberry - vscode' : 'IDE - vscode', | ||||||||||
| extensionVersion: extensionApi.metadata.version(), | ||||||||||
| vscodeVersion: vscode.version, | ||||||||||
| rovoDevVersion: MIN_SUPPORTED_ROVODEV_VERSION, | ||||||||||
| entitlementType, | ||||||||||
| ...(rovoDevSessionId && { rovoDevSessionId }), | ||||||||||
| }; | ||||||||||
| } | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔎 Testing
The test assertion uses
expect.stringContainingto check for JSON content, but this approach is fragile and could match partial strings incorrectly.Details
📖 Explanation: Using JSON.parse on the value and then checking the parsed object's properties would be more robust and less prone to false positives than string matching.