From 7c1dcd5a539af947d65335dd790a64e58e24b7fc Mon Sep 17 00:00:00 2001 From: Jeff Burdges Date: Tue, 9 Dec 2014 17:17:49 -0500 Subject: [PATCH] Fixes a dumb error in e56da9e01. That's what I get for not updating the tests properly. --- client/gui.go | 5 ++--- client/introduce.go | 14 +++++++------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/client/gui.go b/client/gui.go index a275adc..efcbafa 100644 --- a/client/gui.go +++ b/client/gui.go @@ -2505,9 +2505,7 @@ func (c *guiClient) newContactUI(contact *Contact) interface{} { existing := contact != nil if existing { name = contact.name - } else { - c.initSocialGraphRecords(contact) - } + } grid := Grid{ widgetBase: widgetBase{name: "grid", margin: 5}, @@ -2641,6 +2639,7 @@ Manual keying (not generally recommended) involves exchanging key material with isPending: true, id: c.randId(), } + c.initSocialGraphRecords(contact) c.gui.Actions() <- SetText{name: "error1", text: ""} c.gui.Actions() <- Sensitive{name: "name", sensitive: false} diff --git a/client/introduce.go b/client/introduce.go index 7b276c5..f26aac2 100644 --- a/client/introduce.go +++ b/client/introduce.go @@ -50,13 +50,13 @@ func (contact *Contact) keepSocialGraphRecords() bool { func (c *client) initSocialGraphRecords(contact *Contact) { // If all existing contacts have the Dark Web of Trust disabled then // new contacts should start with the Dark Web of Trust disabled too. - if contact.introducedBy == 0 && len(c.contacts) > 0 { - contact.introducedBy = disableDarkWebOfTrust - for _,cnt := range c.contacts { - if cnt.introducedBy != disableDarkWebOfTrust { - contact.introducedBy = 0 - break - } + if contact.introducedBy != 0 { return } + if c.contacts == nil || len(c.contacts) == 0 { return } + contact.introducedBy = disableDarkWebOfTrust + for _,cnt := range c.contacts { + if cnt.introducedBy != disableDarkWebOfTrust { + contact.introducedBy = 0 + break } } }