Merge pull request 'initialize message count' (#15) from rinnmar17 into trunk
continuous-integration/drone/push Build is failing Details

Reviewed-on: #15
This commit is contained in:
Sarah Jamie Lewis 2021-03-17 16:00:08 -07:00
commit e1d4eed7ac
2 changed files with 3 additions and 1 deletions

View File

@ -7,4 +7,6 @@ type Contact struct {
Picture string `json:"picture"` Picture string `json:"picture"`
Authorization string `json:"authorization"` Authorization string `json:"authorization"`
SaveHistory string `json:"saveConversationHistory"` SaveHistory string `json:"saveConversationHistory"`
Messages int `json:"numMessages"`
Unread int `json:"numUnread"`
} }

View File

@ -111,7 +111,7 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
if !set { if !set {
saveHistory = event.DeleteHistoryDefault saveHistory = event.DeleteHistoryDefault
} }
contacts = append(contacts, Contact{Name: name, Onion: contactInfo.Onion, Status: contactInfo.State, Picture: cpicPath, Authorization: string(contactInfo.Authorization), SaveHistory: saveHistory}) contacts = append(contacts, Contact{Name: name, Onion: contactInfo.Onion, Status: contactInfo.State, Picture: cpicPath, Authorization: string(contactInfo.Authorization), SaveHistory: saveHistory, Messages: contactInfo.Timeline.Len(), Unread: 0,})
} }
bytes, _ := json.Marshal(contacts) bytes, _ := json.Marshal(contacts)