fix: show a server's host instead of repeating its address
A connection saved without a name (including the one migrated from the single-server record) showed its URL as both title and subtitle. Fall back to the host, and migrate old records that stored the URL as the name.
This commit is contained in:
1 parent
13aca21d99
commit
265145af41
4 files changed
+28
-7
No files matched your search
@@ -304,3 +304,15 @@ func TestDeleteConnection(t *testing.T) {
|
||||
a.Until("the connection list to empty", func() bool { return len(st.connections()) == 0 })
|
||||
a.Expect("手动输入地址")
|
||||
}
|
||||
|
||||
func TestLabelFallsBackToHost(t *testing.T) {
|
||||
c := &controller{}
|
||||
conn := storage.Connection{URL: "http://192.168.1.5:3000", Label: "http://192.168.1.5:3000"}
|
||||
if got := c.labelOf(conn); got != "192.168.1.5:3000" {
|
||||
t.Fatalf("label = %q", got)
|
||||
}
|
||||
conn.Label = "Home"
|
||||
if got := c.labelOf(conn); got != "Home" {
|
||||
t.Fatalf("label = %q", got)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user