Re-select selected communication on fetch
This makes it so the UI updates with any changes we pull down.
This commit is contained in:
parent
a8f2c87e38
commit
70d3aef8b3
3 changed files with 12 additions and 6 deletions
|
|
@ -2,6 +2,7 @@ package types
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
//"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
type Contact struct {
|
||||
|
|
@ -12,10 +13,11 @@ type Contact struct {
|
|||
Phone *string `db:"phone" json:"-"`
|
||||
}
|
||||
|
||||
func (c *Contact) MarshalJSON() ([]byte, error) {
|
||||
func (c Contact) MarshalJSON() ([]byte, error) {
|
||||
to_marshal := make(map[string]interface{}, 0)
|
||||
to_marshal["name"] = c.Name
|
||||
to_marshal["has_email"] = (c.Email != nil && *c.Email != "")
|
||||
to_marshal["has_phone"] = (c.Phone != nil && *c.Phone != "")
|
||||
//log.Debug().Msg("marshaling contact")
|
||||
return json.Marshal(to_marshal)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue