Skip to content

Commit

Permalink
Add a comment
Browse files Browse the repository at this point in the history
  • Loading branch information
nirinchev committed Nov 6, 2024
1 parent 0549169 commit 43efe22
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions packages/cli-repl/src/cli-repl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1287,6 +1287,8 @@ export class CliRepl implements MongoshIOProvider {
latest:
await this.updateNotificationManager.getLatestVersionIfMoreRecent(''),
currentVersion,
hasGreetingCTA:
!!(await this.updateNotificationManager.getGreetingCTAForCurrentVersion()),
});
} catch (err: any) {
this.bus.emit('mongosh:error', err, 'startup');
Expand Down
10 changes: 7 additions & 3 deletions packages/cli-repl/src/update-notification-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,13 @@ export class UpdateNotificationManager {
latestKnownMongoshVersion: this.latestKnownMongoshVersion,
cta: {
[currentVersion]: this.currentVersionGreetingCTA,
...(this.latestKnownMongoshVersion && {
[this.latestKnownMongoshVersion]: latestKnownVersionCTA,
}),

// Add the latest known version's CTA if we're not already on latest. This could be used
// next time we start mongosh if the user has updated to latest.
...(this.latestKnownMongoshVersion &&
this.latestKnownMongoshVersion !== currentVersion && {
[this.latestKnownMongoshVersion]: latestKnownVersionCTA,
}),
},
};
await fs.writeFile(localFilePath, JSON.stringify(localFileContents));
Expand Down
1 change: 1 addition & 0 deletions packages/types/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ export interface FetchingUpdateMetadataEvent {
export interface FetchingUpdateMetadataCompleteEvent {
latest: string | null;
currentVersion: string;
hasGreetingCTA: boolean;
}

export interface SessionStartedEvent {
Expand Down

0 comments on commit 43efe22

Please sign in to comment.