Merge pull request 'Save Peer History Settings' (#14) from peersettings into trunk
continuous-integration/drone/push Build is failing Details

Reviewed-on: #14
This commit is contained in:
erinn 2021-03-17 15:49:39 -07:00
commit cf23b04f2d
2 changed files with 6 additions and 1 deletions

View File

@ -6,4 +6,5 @@ type Contact struct {
Status string `json:"status"`
Picture string `json:"picture"`
Authorization string `json:"authorization"`
SaveHistory string `json:"saveConversationHistory"`
}

View File

@ -107,7 +107,11 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
cpicPath := GetPicturePath(cpic)
contactInfo := profile.GetContact(contact)
name, _ := contactInfo.GetAttribute(attr.GetLocalScope(constants.Name))
contacts = append(contacts, Contact{Name: name, Onion: contactInfo.Onion, Status: contactInfo.State, Picture: cpicPath, Authorization: string(contactInfo.Authorization)})
saveHistory, set := contactInfo.GetAttribute(event.SaveHistoryKey)
if !set {
saveHistory = event.DeleteHistoryDefault
}
contacts = append(contacts, Contact{Name: name, Onion: contactInfo.Onion, Status: contactInfo.State, Picture: cpicPath, Authorization: string(contactInfo.Authorization), SaveHistory: saveHistory})
}
bytes, _ := json.Marshal(contacts)