Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: prompt for sign in when toggling coder connect on#204

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ethanndickson merged 1 commit intomainfromethan/sign-in-on-vpn-toggle-regression
Jul 24, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletionsCoder-Desktop/Coder-Desktop/Views/VPN/VPNMenu.swift
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -117,12 +117,15 @@ struct VPNMenu<VPN: VPNService, FS: FileSyncDaemon>: View {
}

private var vpnDisabled: Bool {
vpn.state == .connecting ||
vpn.state == .disconnecting ||
// Prevent starting the VPN before the user has approved the system extension.
vpn.state == .failed(.systemExtensionError(.needsUserApproval)) ||
// Prevent starting the VPN without a VPN configuration.
vpn.state == .failed(.networkExtensionError(.unconfigured))
// Always enabled if signed out, as that will open the sign in window
state.hasSession && (
vpn.state == .connecting ||
vpn.state == .disconnecting ||
// Prevent starting the VPN before the user has approved the system extension.
vpn.state == .failed(.systemExtensionError(.needsUserApproval)) ||
// Prevent starting the VPN without a VPN configuration.
vpn.state == .failed(.networkExtensionError(.unconfigured))
)
}
}

Expand Down
17 changes: 17 additions & 0 deletionsCoder-Desktop/Coder-DesktopTests/VPNMenuTests.swift
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -32,6 +32,21 @@ struct VPNMenuTests {
}
}

@Test
func testVPNLoggedOutUnconfigured() async throws {
vpn.state = .failed(.networkExtensionError(.unconfigured))
try await ViewHosting.host(view) {
try await sut.inspection.inspect { view in
let toggle = try view.find(ViewType.Toggle.self)
// Toggle should be enabled even with a failure that would
// normally make it disabled, because we're signed out.
#expect(!toggle.isDisabled())
#expect(throws: Never.self) { try view.find(text: "Sign in to use Coder Desktop") }
#expect(throws: Never.self) { try view.find(button: "Sign in") }
}
}
}

@Test
func testStartStopCalled() async throws {
try await ViewHosting.host(view) {
Expand DownExpand Up@@ -59,6 +74,7 @@ struct VPNMenuTests {
@Test
func testVPNDisabledWhileConnecting() async throws {
vpn.state = .disabled
state.login(baseAccessURL: URL(string: "https://coder.example.com")!, sessionToken: "fake-token")

try await ViewHosting.host(view) {
try await sut.inspection.inspect { view in
Expand All@@ -79,6 +95,7 @@ struct VPNMenuTests {
@Test
func testVPNDisabledWhileDisconnecting() async throws {
vpn.state = .disabled
state.login(baseAccessURL: URL(string: "https://coder.example.com")!, sessionToken: "fake-token")

try await ViewHosting.host(view) {
try await sut.inspection.inspect { view in
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp