mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-22 23:23:54 +08:00
Fix support for changing names of google contacts when displayName is provided
This commit is contained in:
parent
c4d7b229f4
commit
b0387da59c
1 changed files with 6 additions and 1 deletions
|
@ -216,6 +216,11 @@ export function applyToGoogle(contact: Contact, changes: Partial<ContactBase>) {
|
||||||
const val = changes[key];
|
const val = changes[key];
|
||||||
|
|
||||||
if (key === 'name') {
|
if (key === 'name') {
|
||||||
|
if ('displayName' in val) {
|
||||||
|
// UI only edits surname + given name so we sync the full string
|
||||||
|
// to the new values here if Google provided us with one initially.
|
||||||
|
val.displayName = VCFHelpers.formatDisplayName(val);
|
||||||
|
}
|
||||||
if (!info.names || info.names.length === 0) {
|
if (!info.names || info.names.length === 0) {
|
||||||
info.names = [Object.assign({ metadata }, val)];
|
info.names = [Object.assign({ metadata }, val)];
|
||||||
} else {
|
} else {
|
||||||
|
@ -248,7 +253,7 @@ export function applyToGoogle(contact: Contact, changes: Partial<ContactBase>) {
|
||||||
|
|
||||||
export function parse(contact: Contact): ContactParseResult {
|
export function parse(contact: Contact): ContactParseResult {
|
||||||
try {
|
try {
|
||||||
return !contact.info
|
return !contact.info || Object.keys(contact.info).length === 0
|
||||||
? fromContact(contact)
|
? fromContact(contact)
|
||||||
: 'vcf' in contact.info
|
: 'vcf' in contact.info
|
||||||
? fromVCF(contact.info)
|
? fromVCF(contact.info)
|
||||||
|
|
Loading…
Reference in a new issue