Browse Source

fix

feature/dockerfile-arm
Evan Feenstra 5 years ago
parent
commit
7236dd24ad
  1. 5
      api/controllers/contacts.ts
  2. 5
      dist/api/controllers/contacts.js
  3. 2
      dist/api/controllers/contacts.js.map

5
api/controllers/contacts.ts

@ -142,12 +142,13 @@ const deleteContact = async (req, res) => {
const owner = await models.Contact.findOne({ where: { isOwner: true }})
const tribesImAdminOf = await models.Chat.findAll({where:{ownerPubkey:owner.publicKey}})
console.log("TRIES IM ADMIJ OF", tribesImAdminOf)
console.log("TRIES IM ADMIN OF", tribesImAdminOf)
const tribesIdArray = tribesImAdminOf && tribesImAdminOf.length && tribesImAdminOf.map(t=>t.id)
console.log("TRIES ID ARRAY",tribesIdArray)
let okToDelete = true
if(tribesIdArray && tribesIdArray.length) {
const thisContactMembers = await models.ChatMember.findAll({where:{id:{in:tribesIdArray}}})
const thisContactMembers = await models.ChatMember.findAll({where:{chatId:{in:tribesIdArray}}})
console.log("thisContactMembers",thisContactMembers)
if(thisContactMembers&&thisContactMembers.length){
// IS A MEMBER! dont delete, instead just set from_group=true
okToDelete=false

5
dist/api/controllers/contacts.js

@ -129,12 +129,13 @@ const deleteContact = (req, res) => __awaiter(void 0, void 0, void 0, function*
return;
const owner = yield models_1.models.Contact.findOne({ where: { isOwner: true } });
const tribesImAdminOf = yield models_1.models.Chat.findAll({ where: { ownerPubkey: owner.publicKey } });
console.log("TRIES IM ADMIJ OF", tribesImAdminOf);
console.log("TRIES IM ADMIN OF", tribesImAdminOf);
const tribesIdArray = tribesImAdminOf && tribesImAdminOf.length && tribesImAdminOf.map(t => t.id);
console.log("TRIES ID ARRAY", tribesIdArray);
let okToDelete = true;
if (tribesIdArray && tribesIdArray.length) {
const thisContactMembers = yield models_1.models.ChatMember.findAll({ where: { id: { in: tribesIdArray } } });
const thisContactMembers = yield models_1.models.ChatMember.findAll({ where: { chatId: { in: tribesIdArray } } });
console.log("thisContactMembers", thisContactMembers);
if (thisContactMembers && thisContactMembers.length) {
// IS A MEMBER! dont delete, instead just set from_group=true
okToDelete = false;

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

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save