Skip to content

Commit 43efe22

Browse files
committed
Add a comment
1 parent 0549169 commit 43efe22

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

packages/cli-repl/src/cli-repl.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,6 +1287,8 @@ export class CliRepl implements MongoshIOProvider {
12871287
latest:
12881288
await this.updateNotificationManager.getLatestVersionIfMoreRecent(''),
12891289
currentVersion,
1290+
hasGreetingCTA:
1291+
!!(await this.updateNotificationManager.getGreetingCTAForCurrentVersion()),
12901292
});
12911293
} catch (err: any) {
12921294
this.bus.emit('mongosh:error', err, 'startup');

packages/cli-repl/src/update-notification-manager.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,13 @@ export class UpdateNotificationManager {
184184
latestKnownMongoshVersion: this.latestKnownMongoshVersion,
185185
cta: {
186186
[currentVersion]: this.currentVersionGreetingCTA,
187-
...(this.latestKnownMongoshVersion && {
188-
[this.latestKnownMongoshVersion]: latestKnownVersionCTA,
189-
}),
187+
188+
// Add the latest known version's CTA if we're not already on latest. This could be used
189+
// next time we start mongosh if the user has updated to latest.
190+
...(this.latestKnownMongoshVersion &&
191+
this.latestKnownMongoshVersion !== currentVersion && {
192+
[this.latestKnownMongoshVersion]: latestKnownVersionCTA,
193+
}),
190194
},
191195
};
192196
await fs.writeFile(localFilePath, JSON.stringify(localFileContents));

packages/types/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ export interface FetchingUpdateMetadataEvent {
179179
export interface FetchingUpdateMetadataCompleteEvent {
180180
latest: string | null;
181181
currentVersion: string;
182+
hasGreetingCTA: boolean;
182183
}
183184

184185
export interface SessionStartedEvent {

0 commit comments

Comments
 (0)