[#11046] Add local contact names
This commit is contained in:
parent
88a3022ea8
commit
2eaa1fcad7
|
@ -59,6 +59,7 @@ type Contact struct {
|
|||
|
||||
DeviceInfo []ContactDeviceInfo `json:"deviceInfo"`
|
||||
TributeToTalk string `json:"tributeToTalk,omitempty"`
|
||||
LocalNickname string `json:"localNickname,omitempty"`
|
||||
}
|
||||
|
||||
func (c Contact) PublicKey() (*ecdsa.PublicKey, error) {
|
||||
|
@ -119,7 +120,7 @@ func buildContact(publicKey *ecdsa.PublicKey) (*Contact, error) {
|
|||
// HasCustomFields returns whether the the contact has any field that is valuable
|
||||
// to the client other than the computed name/image
|
||||
func (c Contact) HasCustomFields() bool {
|
||||
return c.IsAdded() || c.HasBeenAdded() || c.IsBlocked() || c.ENSVerified
|
||||
return c.IsAdded() || c.HasBeenAdded() || c.IsBlocked() || c.ENSVerified || c.LocalNickname != ""
|
||||
}
|
||||
|
||||
func contactIDFromPublicKey(key *ecdsa.PublicKey) string {
|
||||
|
|
|
@ -209,6 +209,8 @@ func (m *MessageHandler) HandleSyncInstallationContact(state *ReceivedMessageSta
|
|||
}
|
||||
contact.Photo = message.ProfileImage
|
||||
contact.LastUpdated = message.Clock
|
||||
contact.LocalNickname = message.LocalNickname
|
||||
|
||||
state.ModifiedContacts[contact.ID] = true
|
||||
state.AllContacts[contact.ID] = contact
|
||||
}
|
||||
|
|
|
@ -1244,6 +1244,14 @@ func (m *Messenger) isNewContact(contact *Contact) bool {
|
|||
return contact.IsAdded() && (!ok || !previousContact.IsAdded())
|
||||
}
|
||||
|
||||
func (m *Messenger) hasNicknameChanged(contact *Contact) bool {
|
||||
previousContact, ok := m.allContacts[contact.ID]
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
return contact.LocalNickname != previousContact.LocalNickname
|
||||
}
|
||||
|
||||
func (m *Messenger) removedContact(contact *Contact) bool {
|
||||
previousContact, ok := m.allContacts[contact.ID]
|
||||
if !ok {
|
||||
|
@ -1261,7 +1269,7 @@ func (m *Messenger) saveContact(contact *Contact) error {
|
|||
contact.Identicon = identicon
|
||||
contact.Alias = name
|
||||
|
||||
if m.isNewContact(contact) {
|
||||
if m.isNewContact(contact) || m.hasNicknameChanged(contact) {
|
||||
err := m.syncContact(context.Background(), contact)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -1843,10 +1851,11 @@ func (m *Messenger) syncContact(ctx context.Context, contact *Contact) error {
|
|||
clock, _ := chat.NextClockAndTimestamp(m.getTimesource())
|
||||
|
||||
syncMessage := &protobuf.SyncInstallationContact{
|
||||
Clock: clock,
|
||||
Id: contact.ID,
|
||||
EnsName: contact.Name,
|
||||
ProfileImage: contact.Photo,
|
||||
Clock: clock,
|
||||
Id: contact.ID,
|
||||
EnsName: contact.Name,
|
||||
ProfileImage: contact.Photo,
|
||||
LocalNickname: contact.LocalNickname,
|
||||
}
|
||||
encodedMessage, err := proto.Marshal(syncMessage)
|
||||
if err != nil {
|
||||
|
|
|
@ -172,6 +172,7 @@ func (s *MessengerInstallationSuite) TestSyncInstallation() {
|
|||
contact, err := buildContact(&contactKey.PublicKey)
|
||||
s.Require().NoError(err)
|
||||
contact.SystemTags = append(contact.SystemTags, contactAdded)
|
||||
contact.LocalNickname = "Test Nickname"
|
||||
err = s.m.SaveContact(contact)
|
||||
s.Require().NoError(err)
|
||||
|
||||
|
@ -249,6 +250,7 @@ func (s *MessengerInstallationSuite) TestSyncInstallation() {
|
|||
s.Require().NotNil(statusChat)
|
||||
|
||||
s.Require().True(actualContact.IsAdded())
|
||||
s.Require().Equal("Test Nickname", actualContact.LocalNickname)
|
||||
s.Require().NoError(theirMessenger.Shutdown())
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
// 1595862781_add_audio_data.up.sql (246B)
|
||||
// 1595865249_create_emoji_reactions_table.down.sql (27B)
|
||||
// 1595865249_create_emoji_reactions_table.up.sql (300B)
|
||||
// 1597757544_add_nickname.up.sql (52B)
|
||||
// doc.go (850B)
|
||||
|
||||
package migrations
|
||||
|
@ -102,7 +103,7 @@ func _000001_initDownDbSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "000001_init.down.db.sql", size: 65, mode: os.FileMode(0644), modTime: time.Unix(1578682784, 0)}
|
||||
info := bindataFileInfo{name: "000001_init.down.db.sql", size: 65, mode: os.FileMode(0644), modTime: time.Unix(1596451065, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x5e, 0xbb, 0x3f, 0x1, 0x75, 0x19, 0x70, 0x86, 0xa7, 0x34, 0x40, 0x17, 0x34, 0x3e, 0x18, 0x51, 0x79, 0xd4, 0x22, 0xad, 0x8f, 0x80, 0xcc, 0xa6, 0xcc, 0x6, 0x2b, 0x62, 0x2, 0x47, 0xba, 0xf9}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -122,7 +123,7 @@ func _000001_initUpDbSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "000001_init.up.db.sql", size: 2719, mode: os.FileMode(0644), modTime: time.Unix(1578682784, 0)}
|
||||
info := bindataFileInfo{name: "000001_init.up.db.sql", size: 2719, mode: os.FileMode(0644), modTime: time.Unix(1596451065, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x60, 0xdc, 0xeb, 0xe, 0xc2, 0x4f, 0x75, 0xa, 0xf6, 0x3e, 0xc7, 0xc4, 0x4, 0xe2, 0xe1, 0xa4, 0x73, 0x2f, 0x4a, 0xad, 0x1a, 0x0, 0xc3, 0x93, 0x9d, 0x77, 0x3e, 0x31, 0x91, 0x77, 0x2e, 0xc8}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -142,7 +143,7 @@ func _000002_add_last_ens_clock_valueDownSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "000002_add_last_ens_clock_value.down.sql", size: 0, mode: os.FileMode(0644), modTime: time.Unix(1595493797, 0)}
|
||||
info := bindataFileInfo{name: "000002_add_last_ens_clock_value.down.sql", size: 0, mode: os.FileMode(0644), modTime: time.Unix(1596451065, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -162,7 +163,7 @@ func _000002_add_last_ens_clock_valueUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "000002_add_last_ens_clock_value.up.sql", size: 77, mode: os.FileMode(0644), modTime: time.Unix(1595493797, 0)}
|
||||
info := bindataFileInfo{name: "000002_add_last_ens_clock_value.up.sql", size: 77, mode: os.FileMode(0644), modTime: time.Unix(1596451065, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x4d, 0x3, 0x8f, 0xd5, 0x85, 0x83, 0x47, 0xbe, 0xf9, 0x82, 0x7e, 0x81, 0xa4, 0xbd, 0xaa, 0xd5, 0x98, 0x18, 0x5, 0x2d, 0x82, 0x42, 0x3b, 0x3, 0x50, 0xc3, 0x1e, 0x84, 0x35, 0xf, 0xb6, 0x2b}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -182,7 +183,7 @@ func _1586358095_add_replaceDownSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1586358095_add_replace.down.sql", size: 0, mode: os.FileMode(0644), modTime: time.Unix(1595493797, 0)}
|
||||
info := bindataFileInfo{name: "1586358095_add_replace.down.sql", size: 0, mode: os.FileMode(0644), modTime: time.Unix(1596451065, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -202,7 +203,7 @@ func _1586358095_add_replaceUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1586358095_add_replace.up.sql", size: 224, mode: os.FileMode(0644), modTime: time.Unix(1595493797, 0)}
|
||||
info := bindataFileInfo{name: "1586358095_add_replace.up.sql", size: 224, mode: os.FileMode(0644), modTime: time.Unix(1596451065, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd2, 0xb3, 0xa9, 0xc7, 0x7f, 0x9d, 0x8f, 0x43, 0x8c, 0x9e, 0x58, 0x8d, 0x44, 0xbc, 0xfa, 0x6b, 0x5f, 0x3f, 0x5a, 0xbe, 0xe8, 0xb1, 0x16, 0xf, 0x91, 0x2a, 0xa0, 0x71, 0xbb, 0x8d, 0x6b, 0xcb}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -222,7 +223,7 @@ func _1588665364_add_image_dataDownSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1588665364_add_image_data.down.sql", size: 0, mode: os.FileMode(0644), modTime: time.Unix(1595493797, 0)}
|
||||
info := bindataFileInfo{name: "1588665364_add_image_data.down.sql", size: 0, mode: os.FileMode(0644), modTime: time.Unix(1596451065, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -242,7 +243,7 @@ func _1588665364_add_image_dataUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1588665364_add_image_data.up.sql", size: 186, mode: os.FileMode(0644), modTime: time.Unix(1595493797, 0)}
|
||||
info := bindataFileInfo{name: "1588665364_add_image_data.up.sql", size: 186, mode: os.FileMode(0644), modTime: time.Unix(1596451065, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd6, 0xc6, 0x35, 0xb4, 0x4c, 0x39, 0x96, 0x29, 0x30, 0xda, 0xf4, 0x8f, 0xcb, 0xf1, 0x9f, 0x84, 0xdc, 0x88, 0xd4, 0xd5, 0xbc, 0xb6, 0x5b, 0x46, 0x78, 0x67, 0x76, 0x1a, 0x5, 0x36, 0xdc, 0xe5}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -262,7 +263,7 @@ func _1589365189_add_pow_targetDownSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1589365189_add_pow_target.down.sql", size: 0, mode: os.FileMode(0644), modTime: time.Unix(1595493797, 0)}
|
||||
info := bindataFileInfo{name: "1589365189_add_pow_target.down.sql", size: 0, mode: os.FileMode(0644), modTime: time.Unix(1596451065, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -282,7 +283,7 @@ func _1589365189_add_pow_targetUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1589365189_add_pow_target.up.sql", size: 66, mode: os.FileMode(0644), modTime: time.Unix(1595493797, 0)}
|
||||
info := bindataFileInfo{name: "1589365189_add_pow_target.up.sql", size: 66, mode: os.FileMode(0644), modTime: time.Unix(1596451065, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x4e, 0x3a, 0xe2, 0x2e, 0x7d, 0xaf, 0xbb, 0xcc, 0x21, 0xa1, 0x7a, 0x41, 0x9a, 0xd0, 0xbb, 0xa9, 0xc8, 0x35, 0xf9, 0x32, 0x34, 0x46, 0x44, 0x9a, 0x86, 0x40, 0x7c, 0xb9, 0x23, 0xc7, 0x3, 0x3f}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -302,7 +303,7 @@ func _1591277220_add_index_messagesDownSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1591277220_add_index_messages.down.sql", size: 237, mode: os.FileMode(0644), modTime: time.Unix(1595493797, 0)}
|
||||
info := bindataFileInfo{name: "1591277220_add_index_messages.down.sql", size: 237, mode: os.FileMode(0644), modTime: time.Unix(1596451065, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x79, 0xe5, 0x42, 0x56, 0x64, 0x1d, 0xb7, 0x8a, 0x1b, 0x0, 0x99, 0xf0, 0x18, 0x8c, 0x69, 0xe3, 0x14, 0x3a, 0x7f, 0x78, 0xfe, 0xe3, 0x2e, 0xcb, 0x6e, 0x5c, 0x8c, 0x1f, 0x7b, 0xfc, 0x21, 0xc7}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -322,7 +323,7 @@ func _1591277220_add_index_messagesUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1591277220_add_index_messages.up.sql", size: 240, mode: os.FileMode(0644), modTime: time.Unix(1595493797, 0)}
|
||||
info := bindataFileInfo{name: "1591277220_add_index_messages.up.sql", size: 240, mode: os.FileMode(0644), modTime: time.Unix(1596451065, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x9c, 0xfe, 0xbe, 0xd5, 0xb8, 0x8f, 0xdd, 0xef, 0xbb, 0xa8, 0xad, 0x7f, 0xed, 0x5b, 0x5b, 0x2f, 0xe6, 0x82, 0x27, 0x78, 0x1f, 0xb9, 0x57, 0xdc, 0x8, 0xc2, 0xb2, 0xa9, 0x9a, 0x4, 0xe1, 0x7a}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -342,7 +343,7 @@ func _1593087212_add_mute_chat_and_raw_message_fieldsDownSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1593087212_add_mute_chat_and_raw_message_fields.down.sql", size: 0, mode: os.FileMode(0644), modTime: time.Unix(1595862768, 0)}
|
||||
info := bindataFileInfo{name: "1593087212_add_mute_chat_and_raw_message_fields.down.sql", size: 0, mode: os.FileMode(0644), modTime: time.Unix(1596451065, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -362,7 +363,7 @@ func _1593087212_add_mute_chat_and_raw_message_fieldsUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1593087212_add_mute_chat_and_raw_message_fields.up.sql", size: 215, mode: os.FileMode(0644), modTime: time.Unix(1595862768, 0)}
|
||||
info := bindataFileInfo{name: "1593087212_add_mute_chat_and_raw_message_fields.up.sql", size: 215, mode: os.FileMode(0644), modTime: time.Unix(1596451065, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x73, 0x99, 0x61, 0xd1, 0xaa, 0xb4, 0xbf, 0xaf, 0xd7, 0x20, 0x17, 0x40, 0xf9, 0x2, 0xfb, 0xcc, 0x40, 0x2a, 0xd, 0x86, 0x36, 0x30, 0x88, 0x89, 0x25, 0x80, 0x42, 0xb0, 0x5b, 0xe9, 0x73, 0x78}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -382,7 +383,7 @@ func _1595862781_add_audio_dataDownSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1595862781_add_audio_data.down.sql", size: 0, mode: os.FileMode(0644), modTime: time.Unix(1595864522, 0)}
|
||||
info := bindataFileInfo{name: "1595862781_add_audio_data.down.sql", size: 0, mode: os.FileMode(0644), modTime: time.Unix(1596451065, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -402,7 +403,7 @@ func _1595862781_add_audio_dataUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1595862781_add_audio_data.up.sql", size: 246, mode: os.FileMode(0644), modTime: time.Unix(1595864522, 0)}
|
||||
info := bindataFileInfo{name: "1595862781_add_audio_data.up.sql", size: 246, mode: os.FileMode(0644), modTime: time.Unix(1596451065, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xae, 0xd2, 0xee, 0x55, 0xfb, 0x36, 0xa4, 0x92, 0x66, 0xe, 0x81, 0x62, 0x1e, 0x7a, 0x69, 0xa, 0xd5, 0x4b, 0xa5, 0x6a, 0x8d, 0x1d, 0xce, 0xf3, 0x3e, 0xc0, 0x5f, 0x9c, 0x66, 0x1b, 0xb4, 0xed}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -422,7 +423,7 @@ func _1595865249_create_emoji_reactions_tableDownSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1595865249_create_emoji_reactions_table.down.sql", size: 27, mode: os.FileMode(0644), modTime: time.Unix(1595865239, 0)}
|
||||
info := bindataFileInfo{name: "1595865249_create_emoji_reactions_table.down.sql", size: 27, mode: os.FileMode(0644), modTime: time.Unix(1596451065, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x6f, 0xbb, 0xdb, 0x8c, 0xd1, 0x17, 0x1b, 0x19, 0x2a, 0x80, 0xc6, 0xb1, 0xc5, 0x47, 0x74, 0x97, 0x32, 0x30, 0x5, 0xa9, 0x9c, 0xa7, 0x60, 0xa, 0xfe, 0xfb, 0x41, 0x6b, 0x25, 0xad, 0x84, 0x20}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -442,11 +443,31 @@ func _1595865249_create_emoji_reactions_tableUpSql() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1595865249_create_emoji_reactions_table.up.sql", size: 300, mode: os.FileMode(0644), modTime: time.Unix(1595921491, 0)}
|
||||
info := bindataFileInfo{name: "1595865249_create_emoji_reactions_table.up.sql", size: 300, mode: os.FileMode(0644), modTime: time.Unix(1596451065, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x3e, 0xc5, 0x43, 0x5c, 0x3d, 0x53, 0x43, 0x2c, 0x1a, 0xa5, 0xb6, 0xbf, 0x7, 0x4, 0x5a, 0x3e, 0x40, 0x8b, 0xa4, 0x57, 0x12, 0x58, 0xbc, 0x42, 0xe2, 0xc3, 0xde, 0x76, 0x98, 0x80, 0xe2, 0xbe}}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var __1597757544_add_nicknameUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x72\xf4\x09\x71\x0d\x52\x08\x71\x74\xf2\x71\x55\x48\xce\xcf\x2b\x49\x4c\x2e\x29\x56\x70\x74\x71\x51\x70\xf6\xf7\x09\xf5\xf5\x53\xc8\xc9\x4f\x4e\xcc\x89\xcf\xcb\x4c\xce\xce\x4b\xcc\x4d\x55\x08\x71\x8d\x08\xb1\x06\x04\x00\x00\xff\xff\x54\xf7\xdc\x23\x34\x00\x00\x00")
|
||||
|
||||
func _1597757544_add_nicknameUpSqlBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
__1597757544_add_nicknameUpSql,
|
||||
"1597757544_add_nickname.up.sql",
|
||||
)
|
||||
}
|
||||
|
||||
func _1597757544_add_nicknameUpSql() (*asset, error) {
|
||||
bytes, err := _1597757544_add_nicknameUpSqlBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "1597757544_add_nickname.up.sql", size: 52, mode: os.FileMode(0644), modTime: time.Unix(1598445725, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xf4, 0xa2, 0x64, 0x50, 0xc5, 0x4, 0xb9, 0x8b, 0xd1, 0x18, 0x9b, 0xc3, 0x91, 0x36, 0x2a, 0x1f, 0xc3, 0x6c, 0x2d, 0x92, 0xf8, 0x5e, 0xff, 0xb1, 0x59, 0x61, 0x2, 0x1c, 0xe1, 0x85, 0x90, 0xa4}}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var _docGo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x84\x52\x3f\x8f\xdb\x3e\x0c\xdd\xf3\x29\x1e\x6e\xb9\xe5\x22\x07\xf8\xfd\xa6\xdb\x3a\x74\xe8\xd2\x2e\xd9\x0b\x46\xa6\x6d\x22\x32\xe5\x8a\xf4\x39\xf9\xf6\x85\x74\x17\x9c\x51\x14\xe8\x4a\x89\x8f\xef\x5f\xd7\xe1\x3c\x89\x61\x90\xc4\x10\x83\x72\x64\x33\x2a\x77\x5c\x38\xd2\x6a\x8c\xa7\x51\x7c\x5a\x2f\x21\xe6\xb9\x33\x27\x5f\xed\x28\x73\x37\xcb\x58\xc8\xb9\x7b\xfb\xff\xe9\xd0\x75\x88\xa4\xcf\x8e\x89\xb4\x4f\xdc\xb0\x0c\xe6\x54\x5c\x74\xc4\x26\x3e\x81\xb0\x14\x1e\xe4\x16\xf0\xc5\x91\x98\xcc\xe1\x13\xf9\xb3\xc1\x27\x46\x24\xe3\x0a\x33\xe4\x82\x31\x1f\x2f\xa2\x3d\x39\x85\x3a\xfa\x36\xec\x26\x95\x61\xa4\x94\xb8\xc7\x50\xf2\xdc\x76\x8d\x66\x46\x2f\x85\xa3\xe7\x72\x7f\x01\x99\xb1\x43\x69\x66\xab\xfb\x13\xbd\x31\x34\x7f\x9c\x07\x69\xff\x6f\x45\xd8\x72\xb9\x1a\xc8\xc0\xb7\x85\xa3\x73\x1f\x0e\x15\xeb\xfb\x8f\xf3\xd7\x57\x9c\x27\xae\xf0\x55\x5a\x1e\x1a\x85\x66\x9e\x32\xf7\x06\xcf\x18\x72\x4a\x79\x6b\x0f\xab\xca\x0d\x2e\x33\x9b\xd3\xbc\x20\x66\x7d\x63\x75\xc9\x5a\xd1\x56\x4d\x72\xe5\xf6\xcf\xb7\x0c\x51\x71\xa1\xf4\xee\x5e\x93\x7e\x7e\x37\xe8\x11\x44\x5c\x4b\x61\xf5\x74\x6f\x2b\xac\xb1\xdc\x97\x8a\x85\x77\xe6\x92\xd5\x9a\xbc\xa5\x64\xcf\x31\xa7\xdd\xbc\xa2\xd9\x44\x85\x3f\x1d\x73\xba\x24\x7e\xc1\x36\x49\x9c\x30\x33\xa9\xb5\x40\xda\x87\x44\xce\xe6\x9f\xfb\x10\x85\x73\x99\xad\x0a\xae\xfc\xaa\xbb\x15\xb3\x16\xe7\x91\xc3\x8e\x50\x33\x7f\xa1\xf8\x51\x85\xc7\x95\xd5\xd8\x40\x7f\x98\xf2\x08\x79\x63\x50\xdf\xe3\x74\x3a\x9d\xfe\xfb\x19\x42\x68\x5d\xe0\x1b\xcd\x4b\xa5\xe9\xb5\xa3\x9b\xa4\x84\x0b\x43\x46\xcd\x85\xfb\xca\x8a\x6f\x62\xad\x64\x31\x09\xab\xd7\xcc\x2a\x5e\x4e\x3d\x97\xaa\x47\xf7\x7a\xfe\x66\x59\x38\x1c\x16\x8a\x57\x1a\x19\xf6\x2b\x89\x73\x0d\x7a\xcc\xaf\x23\x2b\xd7\x3a\xec\xcb\x77\x5c\xae\xe3\xde\xec\x63\x46\x08\xdd\xe7\x20\x8c\x19\xe1\xf0\x3b\x00\x00\xff\xff\x12\xcd\x7f\xc4\x52\x03\x00\x00")
|
||||
|
||||
func docGoBytes() ([]byte, error) {
|
||||
|
@ -462,7 +483,7 @@ func docGo() (*asset, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "doc.go", size: 850, mode: os.FileMode(0644), modTime: time.Unix(1595493797, 0)}
|
||||
info := bindataFileInfo{name: "doc.go", size: 850, mode: os.FileMode(0644), modTime: time.Unix(1596451065, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xa0, 0xcc, 0x41, 0xe1, 0x61, 0x12, 0x97, 0xe, 0x36, 0x8c, 0xa7, 0x9e, 0xe0, 0x6e, 0x59, 0x9e, 0xee, 0xd5, 0x4a, 0xcf, 0x1e, 0x60, 0xd6, 0xc3, 0x3a, 0xc9, 0x6c, 0xf2, 0x86, 0x5a, 0xb4, 0x1e}}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -594,6 +615,8 @@ var _bindata = map[string]func() (*asset, error){
|
|||
|
||||
"1595865249_create_emoji_reactions_table.up.sql": _1595865249_create_emoji_reactions_tableUpSql,
|
||||
|
||||
"1597757544_add_nickname.up.sql": _1597757544_add_nicknameUpSql,
|
||||
|
||||
"doc.go": docGo,
|
||||
}
|
||||
|
||||
|
@ -656,7 +679,8 @@ var _bintree = &bintree{nil, map[string]*bintree{
|
|||
"1595862781_add_audio_data.up.sql": &bintree{_1595862781_add_audio_dataUpSql, map[string]*bintree{}},
|
||||
"1595865249_create_emoji_reactions_table.down.sql": &bintree{_1595865249_create_emoji_reactions_tableDownSql, map[string]*bintree{}},
|
||||
"1595865249_create_emoji_reactions_table.up.sql": &bintree{_1595865249_create_emoji_reactions_tableUpSql, map[string]*bintree{}},
|
||||
"doc.go": &bintree{docGo, map[string]*bintree{}},
|
||||
"1597757544_add_nickname.up.sql": &bintree{_1597757544_add_nicknameUpSql, map[string]*bintree{}},
|
||||
"doc.go": &bintree{docGo, map[string]*bintree{}},
|
||||
}}
|
||||
|
||||
// RestoreAsset restores an asset under the given directory.
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
ALTER TABLE contacts ADD COLUMN local_nickname TEXT;
|
|
@ -359,7 +359,8 @@ func (db sqlitePersistence) Contacts() ([]*Contact, error) {
|
|||
device_info,
|
||||
ens_verified,
|
||||
ens_verified_at,
|
||||
tribute_to_talk
|
||||
tribute_to_talk,
|
||||
local_nickname
|
||||
FROM contacts
|
||||
`)
|
||||
if err != nil {
|
||||
|
@ -374,6 +375,7 @@ func (db sqlitePersistence) Contacts() ([]*Contact, error) {
|
|||
contact Contact
|
||||
encodedDeviceInfo []byte
|
||||
encodedSystemTags []byte
|
||||
nickname sql.NullString
|
||||
)
|
||||
err := rows.Scan(
|
||||
&contact.ID,
|
||||
|
@ -388,11 +390,16 @@ func (db sqlitePersistence) Contacts() ([]*Contact, error) {
|
|||
&contact.ENSVerified,
|
||||
&contact.ENSVerifiedAt,
|
||||
&contact.TributeToTalk,
|
||||
&nickname,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if nickname.Valid {
|
||||
contact.LocalNickname = nickname.String
|
||||
}
|
||||
|
||||
if encodedDeviceInfo != nil {
|
||||
// Restore device info
|
||||
deviceInfoDecoder := gob.NewDecoder(bytes.NewBuffer(encodedDeviceInfo))
|
||||
|
@ -562,8 +569,9 @@ func (db sqlitePersistence) SaveContact(contact *Contact, tx *sql.Tx) (err error
|
|||
device_info,
|
||||
ens_verified,
|
||||
ens_verified_at,
|
||||
tribute_to_talk
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
tribute_to_talk,
|
||||
local_nickname
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?)
|
||||
`)
|
||||
if err != nil {
|
||||
return
|
||||
|
@ -583,6 +591,7 @@ func (db sqlitePersistence) SaveContact(contact *Contact, tx *sql.Tx) (err error
|
|||
contact.ENSVerified,
|
||||
contact.ENSVerifiedAt,
|
||||
contact.TributeToTalk,
|
||||
contact.LocalNickname,
|
||||
)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -90,6 +90,7 @@ type SyncInstallationContact struct {
|
|||
EnsName string `protobuf:"bytes,4,opt,name=ens_name,json=ensName,proto3" json:"ens_name,omitempty"`
|
||||
LastUpdated uint64 `protobuf:"varint,5,opt,name=last_updated,json=lastUpdated,proto3" json:"last_updated,omitempty"`
|
||||
SystemTags []string `protobuf:"bytes,6,rep,name=system_tags,json=systemTags,proto3" json:"system_tags,omitempty"`
|
||||
LocalNickname string `protobuf:"bytes,7,opt,name=local_nickname,json=localNickname,proto3" json:"local_nickname,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
|
@ -162,6 +163,13 @@ func (m *SyncInstallationContact) GetSystemTags() []string {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (m *SyncInstallationContact) GetLocalNickname() string {
|
||||
if m != nil {
|
||||
return m.LocalNickname
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type SyncInstallationAccount struct {
|
||||
Clock uint64 `protobuf:"varint,1,opt,name=clock,proto3" json:"clock,omitempty"`
|
||||
ProfileImage string `protobuf:"bytes,2,opt,name=profile_image,json=profileImage,proto3" json:"profile_image,omitempty"`
|
||||
|
@ -327,32 +335,35 @@ func init() {
|
|||
proto.RegisterType((*SyncInstallation)(nil), "protobuf.SyncInstallation")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("pairing.proto", fileDescriptor_d61ab7221f0b5518) }
|
||||
func init() {
|
||||
proto.RegisterFile("pairing.proto", fileDescriptor_d61ab7221f0b5518)
|
||||
}
|
||||
|
||||
var fileDescriptor_d61ab7221f0b5518 = []byte{
|
||||
// 378 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xcf, 0x6e, 0x9b, 0x40,
|
||||
0x10, 0xc6, 0x05, 0xf8, 0x5f, 0x07, 0xdb, 0xb5, 0x56, 0x95, 0xba, 0xed, 0xa5, 0x98, 0x56, 0xaa,
|
||||
0x4f, 0x3e, 0xb4, 0xc7, 0xaa, 0x87, 0xc4, 0x87, 0xc8, 0x97, 0xc8, 0x22, 0xce, 0x19, 0xad, 0x97,
|
||||
0x35, 0x5e, 0x05, 0x96, 0x15, 0xbb, 0x24, 0xe2, 0x05, 0xf2, 0x62, 0x79, 0x88, 0xbc, 0x4e, 0xc4,
|
||||
0x62, 0x3b, 0xc8, 0x0e, 0x51, 0x4e, 0x2c, 0x1f, 0xb3, 0xf3, 0xfd, 0xbe, 0x19, 0x60, 0x24, 0x09,
|
||||
0xcf, 0xb9, 0x88, 0xe7, 0x32, 0xcf, 0x74, 0x86, 0x06, 0xe6, 0xb1, 0x29, 0xb6, 0xfe, 0xa3, 0x05,
|
||||
0x93, 0x15, 0xe1, 0xf9, 0x52, 0x28, 0x4d, 0x92, 0x84, 0x68, 0x9e, 0x09, 0xf4, 0x05, 0xba, 0x34,
|
||||
0xc9, 0xe8, 0x1d, 0xb6, 0x3c, 0x6b, 0xd6, 0x09, 0xea, 0x17, 0xf4, 0x1b, 0x3e, 0xf3, 0x46, 0x55,
|
||||
0xc8, 0x23, 0x6c, 0x7b, 0xd6, 0xec, 0x53, 0x30, 0x6e, 0xca, 0xcb, 0x08, 0xfd, 0x00, 0x37, 0x62,
|
||||
0xf7, 0x9c, 0xb2, 0x50, 0x97, 0x92, 0x61, 0xc7, 0x14, 0x41, 0x2d, 0xad, 0x4b, 0xc9, 0x10, 0x82,
|
||||
0x8e, 0x20, 0x29, 0xc3, 0x1d, 0xf3, 0xc5, 0x9c, 0xfd, 0x27, 0x0b, 0xbe, 0xde, 0x94, 0x82, 0x36,
|
||||
0x41, 0x16, 0x99, 0xd0, 0x84, 0xea, 0x16, 0x9e, 0x31, 0xd8, 0x47, 0x04, 0x9b, 0x47, 0xe8, 0x27,
|
||||
0x8c, 0x64, 0x9e, 0x6d, 0x79, 0xc2, 0x42, 0x9e, 0x92, 0xf8, 0x60, 0x3c, 0xdc, 0x8b, 0xcb, 0x4a,
|
||||
0x43, 0xdf, 0x60, 0xc0, 0x84, 0x0a, 0x1b, 0xf6, 0x7d, 0x26, 0xd4, 0x35, 0x49, 0x19, 0x9a, 0xc2,
|
||||
0x30, 0x21, 0x4a, 0x87, 0x85, 0x8c, 0x88, 0x66, 0x11, 0xee, 0x1a, 0x33, 0xb7, 0xd2, 0x6e, 0x6b,
|
||||
0xa9, 0x4a, 0xa6, 0x4a, 0xa5, 0x59, 0x1a, 0x6a, 0x12, 0x2b, 0xdc, 0xf3, 0x9c, 0x2a, 0x59, 0x2d,
|
||||
0xad, 0x49, 0xac, 0xfc, 0x87, 0xf3, 0x10, 0x17, 0x94, 0x66, 0x85, 0x68, 0x0b, 0x71, 0x06, 0x6d,
|
||||
0xbf, 0x01, 0x7d, 0x4a, 0xe6, 0x9c, 0x91, 0xf9, 0x97, 0xf0, 0xfd, 0xd4, 0x78, 0x55, 0x6c, 0x12,
|
||||
0x4e, 0x17, 0x3b, 0xf2, 0xc1, 0x01, 0xfa, 0xcf, 0x16, 0x4c, 0x4e, 0x9b, 0xa0, 0xff, 0x30, 0xa0,
|
||||
0xf5, 0x1a, 0x14, 0xb6, 0x3c, 0x67, 0xe6, 0xfe, 0x99, 0xce, 0x0f, 0x7f, 0xcf, 0xbc, 0x65, 0x61,
|
||||
0xc1, 0xf1, 0x0a, 0xba, 0x82, 0xa1, 0x34, 0x1c, 0x21, 0xdd, 0x11, 0xad, 0xb0, 0x6d, 0x5a, 0xfc,
|
||||
0x6a, 0x6f, 0xf1, 0x4a, 0x1d, 0xb8, 0xf2, 0x78, 0x56, 0xe8, 0x1f, 0xf4, 0x49, 0x3d, 0x49, 0x13,
|
||||
0xff, 0x5d, 0x8c, 0xfd, 0xc8, 0x83, 0xc3, 0x8d, 0x4d, 0xcf, 0x94, 0xfe, 0x7d, 0x09, 0x00, 0x00,
|
||||
0xff, 0xff, 0xd7, 0x5f, 0x3a, 0x87, 0x07, 0x03, 0x00, 0x00,
|
||||
// 397 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xcf, 0x8e, 0xd3, 0x30,
|
||||
0x10, 0xc6, 0x95, 0xb4, 0xbb, 0x2d, 0xd3, 0x3f, 0xac, 0x2c, 0x24, 0x0c, 0x17, 0xb2, 0x01, 0x44,
|
||||
0x4f, 0x3d, 0xc0, 0x11, 0x71, 0x80, 0x3d, 0xa0, 0x5e, 0x56, 0xab, 0xb0, 0x9c, 0xad, 0xa9, 0xe3,
|
||||
0xcd, 0x5a, 0xeb, 0xd8, 0x56, 0xec, 0x80, 0xf2, 0x02, 0xbc, 0x22, 0xef, 0xc0, 0x53, 0xa0, 0x38,
|
||||
0x6d, 0x89, 0x5a, 0x82, 0x38, 0xc5, 0xf9, 0x32, 0x9e, 0xef, 0xfb, 0xcd, 0x04, 0x16, 0x16, 0x65,
|
||||
0x25, 0x75, 0xb1, 0xb6, 0x95, 0xf1, 0x86, 0x4c, 0xc3, 0x63, 0x5b, 0xdf, 0xa5, 0x3f, 0x22, 0xb8,
|
||||
0xb8, 0x41, 0x59, 0x6d, 0xb4, 0xf3, 0xa8, 0x14, 0x7a, 0x69, 0x34, 0x79, 0x02, 0x67, 0x5c, 0x19,
|
||||
0xfe, 0x40, 0xa3, 0x24, 0x5a, 0x8d, 0xb3, 0xee, 0x85, 0xbc, 0x81, 0xc7, 0xb2, 0x57, 0xc5, 0x64,
|
||||
0x4e, 0xe3, 0x24, 0x5a, 0x3d, 0xca, 0x96, 0x7d, 0x79, 0x93, 0x93, 0x17, 0x30, 0xcb, 0xc5, 0x37,
|
||||
0xc9, 0x05, 0xf3, 0x8d, 0x15, 0x74, 0x14, 0x8a, 0xa0, 0x93, 0x6e, 0x1b, 0x2b, 0x08, 0x81, 0xb1,
|
||||
0xc6, 0x52, 0xd0, 0x71, 0xf8, 0x12, 0xce, 0xe9, 0xaf, 0x08, 0x9e, 0x7e, 0x69, 0x34, 0xef, 0x07,
|
||||
0xb9, 0x32, 0xda, 0x23, 0xf7, 0x03, 0x79, 0x96, 0x10, 0x1f, 0x22, 0xc4, 0x32, 0x27, 0x2f, 0x61,
|
||||
0x61, 0x2b, 0x73, 0x27, 0x95, 0x60, 0xb2, 0xc4, 0x62, 0x6f, 0x3c, 0xdf, 0x89, 0x9b, 0x56, 0x23,
|
||||
0xcf, 0x60, 0x2a, 0xb4, 0x63, 0x3d, 0xfb, 0x89, 0xd0, 0xee, 0x1a, 0x4b, 0x41, 0x2e, 0x61, 0xae,
|
||||
0xd0, 0x79, 0x56, 0xdb, 0x1c, 0xbd, 0xc8, 0xe9, 0x59, 0x30, 0x9b, 0xb5, 0xda, 0xd7, 0x4e, 0x6a,
|
||||
0xc9, 0x5c, 0xe3, 0xbc, 0x28, 0x99, 0xc7, 0xc2, 0xd1, 0xf3, 0x64, 0xd4, 0x92, 0x75, 0xd2, 0x2d,
|
||||
0x16, 0x8e, 0xbc, 0x86, 0xa5, 0x32, 0x1c, 0x15, 0xd3, 0x92, 0x3f, 0x04, 0x93, 0x49, 0x30, 0x59,
|
||||
0x04, 0xf5, 0x7a, 0x27, 0xa6, 0xdf, 0x4f, 0x59, 0x3f, 0x72, 0x6e, 0x6a, 0x3d, 0xc4, 0x7a, 0xc2,
|
||||
0x16, 0xff, 0x85, 0xed, 0x18, 0x60, 0x74, 0x02, 0x90, 0x7e, 0x82, 0xe7, 0xc7, 0xc6, 0x37, 0xf5,
|
||||
0x56, 0x49, 0x7e, 0x75, 0x8f, 0xff, 0x39, 0xe7, 0xf4, 0x67, 0x04, 0x17, 0xc7, 0x4d, 0xc8, 0x07,
|
||||
0x98, 0xf2, 0x6e, 0x5b, 0x8e, 0x46, 0xc9, 0x68, 0x35, 0x7b, 0x7b, 0xb9, 0xde, 0xff, 0x64, 0xeb,
|
||||
0x81, 0xbd, 0x66, 0x87, 0x2b, 0xe4, 0x33, 0xcc, 0x6d, 0xc8, 0xc1, 0xf8, 0x3d, 0x7a, 0x47, 0xe3,
|
||||
0xd0, 0xe2, 0xd5, 0x70, 0x8b, 0x3f, 0xa9, 0xb3, 0x99, 0x3d, 0x9c, 0x1d, 0x79, 0x0f, 0x13, 0xec,
|
||||
0x26, 0x19, 0xf0, 0xff, 0x19, 0x63, 0x37, 0xf2, 0x6c, 0x7f, 0x63, 0x7b, 0x1e, 0x4a, 0xdf, 0xfd,
|
||||
0x0e, 0x00, 0x00, 0xff, 0xff, 0xb5, 0x5c, 0xf1, 0xac, 0x2e, 0x03, 0x00, 0x00,
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ message SyncInstallationContact {
|
|||
string ens_name = 4;
|
||||
uint64 last_updated = 5;
|
||||
repeated string system_tags = 6;
|
||||
string local_nickname = 7;
|
||||
}
|
||||
|
||||
message SyncInstallationAccount {
|
||||
|
|
Loading…
Reference in New Issue