Skip to content

Commit

Permalink
Ship remove auth steps (#3574)
Browse files Browse the repository at this point in the history
Co-authored-by: Tom Ross <[email protected]>
  • Loading branch information
philipp-spiess and umpox authored Mar 28, 2024
1 parent f3c5075 commit b61a315
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 369 deletions.
1 change: 1 addition & 0 deletions vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ This is a log of all notable changes to Cody for VS Code. [Unreleased] changes a

- Chat: The Enhanced Context Settings modal is opened by default for the first chat session. [pull/3547](https://github.com/sourcegraph/cody/pull/3547)
- Add information on which Cody tier is being used to analytics events. [pull/3508](https://github.com/sourcegraph/cody/pull/3508)
- Auth: Enable the new onboarding flow that does not require the redirect back to VS Code for everyone. [pull/3574](https://github.com/sourcegraph/cody/pull/3574)
- Chat: Claude 3 Sonnet is now the default model for every Cody Free or Pro user. [pull/3575](https://github.com/sourcegraph/cody/pull/3575)
- Edit: Removed a previous Edit shortcut (`Shift+Cmd/Ctrl+v`), use `Opt/Alt+K` to trigger Edits. [pull/3591](https://github.com/sourcegraph/cody/pull/3591)

Expand Down
67 changes: 30 additions & 37 deletions vscode/src/chat/chat-view/SidebarViewController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
closeAuthProgressIndicator,
startAuthProgressIndicator,
} from '../../auth/auth-progress-indicator'
import { OnboardingExperimentBranch, logExposure, pickBranch } from '../../services/OnboardingExperiment'
import { addWebviewViewHTML } from './ChatManager'

export interface SidebarChatWebview extends Omit<vscode.Webview, 'postMessage'> {
Expand Down Expand Up @@ -67,46 +66,40 @@ export class SidebarViewController implements vscode.WebviewViewProvider {
const endpoint = DOTCOM_URL.href

let tokenReceiverUrl: string | undefined = undefined
const branch = pickBranch()
if (this.startTokenReceiver) {
logExposure()
if (branch === OnboardingExperimentBranch.RemoveAuthenticationStep) {
closeAuthProgressIndicator()
startAuthProgressIndicator()
tokenReceiverUrl = await this.startTokenReceiver?.(
endpoint,
async (token, endpoint) => {
closeAuthProgressIndicator()
startAuthProgressIndicator()
tokenReceiverUrl = await this.startTokenReceiver(
endpoint,
async (token, endpoint) => {
closeAuthProgressIndicator()
const authStatus = await this.authProvider.auth(endpoint, token)
telemetryService.log(
'CodyVSCodeExtension:auth:fromTokenReceiver',
{
type: 'callback',
from: 'web',
success: Boolean(authStatus?.isLoggedIn),
},
{
hasV2Event: true,
}
)
telemetryRecorder.recordEvent(
'cody.auth.fromTokenReceiver.web',
'succeeded',
{
metadata: {
success: authStatus?.isLoggedIn ? 1 : 0,
},
}
)
if (!authStatus?.isLoggedIn) {
void vscode.window.showErrorMessage(
'Authentication failed. Please check your token and try again.'
)
}
const authStatus = await this.authProvider.auth(endpoint, token)
telemetryService.log(
'CodyVSCodeExtension:auth:fromTokenReceiver',
{
type: 'callback',
from: 'web',
success: Boolean(authStatus?.isLoggedIn),
},
{
hasV2Event: true,
}
)
telemetryRecorder.recordEvent(
'cody.auth.fromTokenReceiver.web',
'succeeded',
{
metadata: {
success: authStatus?.isLoggedIn ? 1 : 0,
},
}
)
if (!authStatus?.isLoggedIn) {
void vscode.window.showErrorMessage(
'Authentication failed. Please check your token and try again.'
)
}
}
}
)

const authProviderSimplified = new AuthProviderSimplified()
const authMethod = message.authMethod || 'dotcom'
Expand Down
154 changes: 0 additions & 154 deletions vscode/src/services/OnboardingExperiment.test.ts

This file was deleted.

Loading

0 comments on commit b61a315

Please sign in to comment.