From 401dcc958047f496c13a944c8a1410b8371dad2e Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Tue, 5 Feb 2019 13:09:38 -0800 Subject: [PATCH] Fixing Bulletin Reply --- go/gothings/gcd.go | 1 + go/gothings/uistate.go | 17 +++++++++++++++++ qml/overlays/BulletinOverlay.qml | 4 ---- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/go/gothings/gcd.go b/go/gothings/gcd.go index 1481211..30d4a09 100644 --- a/go/gothings/gcd.go +++ b/go/gothings/gcd.go @@ -119,6 +119,7 @@ func (this *GrandCentralDispatcher) loadMessagesPaneHelper(handle string) { this.ClearMessages() this.SetCurrentOpenConversation(handle) c := this.UIState.GetContact(handle) + c.Badge = 0 this.UIState.UpdateContact(handle) diff --git a/go/gothings/uistate.go b/go/gothings/uistate.go index 52e6f6d..78c1e34 100644 --- a/go/gothings/uistate.go +++ b/go/gothings/uistate.go @@ -2,6 +2,7 @@ package gothings import ( "cwtch.im/ui/go/constants" + "cwtch.im/ui/go/cwutil" "cwtch.im/ui/go/gobjects" "cwtch.im/ui/go/the" "encoding/base32" @@ -50,6 +51,22 @@ func (this *InterfaceState) AddContact(c *gobjects.Contact) { } func (this *InterfaceState) GetContact(handle string) *gobjects.Contact { + if _, found := this.contacts[handle]; !found { + c := &gobjects.Contact{ + handle, + handle, + cwutil.RandomProfileImage(handle), + "", + 1, + 0, + false, + } + + this.contacts[handle] = c + this.parentGcd.AddContact(c.Handle, c.DisplayName, c.Image, c.Server, c.Badge, c.Status, c.Trusted) + go the.Peer.PeerWithOnion(c.Handle) + } + return this.contacts[handle] } diff --git a/qml/overlays/BulletinOverlay.qml b/qml/overlays/BulletinOverlay.qml index 9ef59ab..06a37fc 100644 --- a/qml/overlays/BulletinOverlay.qml +++ b/qml/overlays/BulletinOverlay.qml @@ -173,10 +173,6 @@ ColumnLayout { } focus: true - onCurrentItemChanged: console.log(model.get(bulletinView.currentIndex).title + ' selected') - - - ListModel { id: jsonModel4 }