Browse Source

fix owner contact update

dependabot/npm_and_yarn/ini-1.3.7
Evan Feenstra 4 years ago
parent
commit
ab53968379
  1. 7
      dist/src/controllers/contacts.js
  2. 2
      dist/src/controllers/contacts.js.map
  3. 8
      src/controllers/contacts.ts

7
dist/src/controllers/contacts.js

@ -80,6 +80,9 @@ exports.updateContact = (req, res) => __awaiter(void 0, void 0, void 0, function
if (!contact) {
return res_1.failure(res, 'no contact found');
}
const contactKeyChanged = attrs['contact_key'] && contact.contactKey !== attrs['contact_key'];
const aliasChanged = attrs['alias'] && contact.alias !== attrs['alias'];
const photoChanged = attrs['photo_url'] && contact.photoUrl !== attrs['photo_url'];
// update contact
const owner = yield contact.update(jsonUtils.jsonToContact(attrs));
res_1.success(res, jsonUtils.contactToJson(owner));
@ -88,10 +91,6 @@ exports.updateContact = (req, res) => __awaiter(void 0, void 0, void 0, function
if (!(attrs['contact_key'] || attrs['alias'] || attrs['photo_url'])) {
return; // skip if not at least one of these
}
console.log("PHOTO URL", attrs["photo_url"], contact.photoUrl);
const contactKeyChanged = attrs['contact_key'] && contact.contactKey !== attrs['contact_key'];
const aliasChanged = attrs['alias'] && contact.alias !== attrs['alias'];
const photoChanged = attrs['photo_url'] && contact.photoUrl !== attrs['photo_url'];
if (!(contactKeyChanged || aliasChanged || photoChanged)) {
return;
}

2
dist/src/controllers/contacts.js.map

File diff suppressed because one or more lines are too long

8
src/controllers/contacts.ts

@ -82,6 +82,10 @@ export const updateContact = async (req, res) => {
if(!contact) {
return failure(res, 'no contact found')
}
const contactKeyChanged = attrs['contact_key'] && contact.contactKey!==attrs['contact_key']
const aliasChanged = attrs['alias'] && contact.alias!==attrs['alias']
const photoChanged = attrs['photo_url'] && contact.photoUrl!==attrs['photo_url']
// update contact
const owner = await contact.update(jsonUtils.jsonToContact(attrs))
@ -91,10 +95,6 @@ export const updateContact = async (req, res) => {
if (!(attrs['contact_key'] || attrs['alias'] || attrs['photo_url'])) {
return // skip if not at least one of these
}
console.log("PHOTO URL", attrs["photo_url"], contact.photoUrl)
const contactKeyChanged = attrs['contact_key'] && contact.contactKey!==attrs['contact_key']
const aliasChanged = attrs['alias'] && contact.alias!==attrs['alias']
const photoChanged = attrs['photo_url'] && contact.photoUrl!==attrs['photo_url']
if(!(contactKeyChanged || aliasChanged || photoChanged)) {
return
}

Loading…
Cancel
Save