diff --git a/api/controllers/messages.ts b/api/controllers/messages.ts index 889c089..40a2395 100644 --- a/api/controllers/messages.ts +++ b/api/controllers/messages.ts @@ -92,30 +92,33 @@ const getAllMessages = async (req, res) => { async function deleteMessage(req, res){ const id = parseInt(req.params.id) - const {chat_id} = req.body const message = await models.Message.findOne({where:{id}}) const uuid = message.uuid await message.update({status: constants.statuses.deleted}) - success(res, {id}) + const chat_id = message.chatId + let chat if(chat_id) { - const chat = await models.Chat.findOne({where:{id:chat_id}}) - const isTribe = chat.type===constants.chat_types.tribe - if(isTribe){ - const owner = await models.Contact.findOne({ where: { isOwner: true }}) - const isTribeOwner = owner.publicKey===chat.ownerPubkey - if(isTribeOwner) { - timers.removeTimerByMsgId(id) - network.sendMessage({ - chat: chat, - sender: owner, - type: constants.message_types.delete, - message: {id,uuid}, - }) - } - } + chat = await models.Chat.findOne({where:{id:chat_id}}) } + success(res, jsonUtils.messageToJson(message, chat)) + + if(!chat) return + const isTribe = chat.type===constants.chat_types.tribe + if(!isTribe) return + + const owner = await models.Contact.findOne({ where: { isOwner: true }}) + const isTribeOwner = owner.publicKey===chat.ownerPubkey + if(!isTribeOwner) return + + timers.removeTimerByMsgId(id) + network.sendMessage({ + chat: chat, + sender: owner, + type: constants.message_types.delete, + message: {id,uuid}, + }) } const sendMessage = async (req, res) => { diff --git a/dist/api/controllers/messages.js b/dist/api/controllers/messages.js index 198d2ce..3fe05d3 100644 --- a/dist/api/controllers/messages.js +++ b/dist/api/controllers/messages.js @@ -88,28 +88,31 @@ exports.getAllMessages = getAllMessages; function deleteMessage(req, res) { return __awaiter(this, void 0, void 0, function* () { const id = parseInt(req.params.id); - const { chat_id } = req.body; const message = yield models_1.models.Message.findOne({ where: { id } }); const uuid = message.uuid; yield message.update({ status: constants.statuses.deleted }); - res_1.success(res, { id }); + const chat_id = message.chatId; + let chat; if (chat_id) { - const chat = yield models_1.models.Chat.findOne({ where: { id: chat_id } }); - const isTribe = chat.type === constants.chat_types.tribe; - if (isTribe) { - const owner = yield models_1.models.Contact.findOne({ where: { isOwner: true } }); - const isTribeOwner = owner.publicKey === chat.ownerPubkey; - if (isTribeOwner) { - timers.removeTimerByMsgId(id); - network.sendMessage({ - chat: chat, - sender: owner, - type: constants.message_types.delete, - message: { id, uuid }, - }); - } - } + chat = yield models_1.models.Chat.findOne({ where: { id: chat_id } }); } + res_1.success(res, jsonUtils.messageToJson(message, chat)); + if (!chat) + return; + const isTribe = chat.type === constants.chat_types.tribe; + if (!isTribe) + return; + const owner = yield models_1.models.Contact.findOne({ where: { isOwner: true } }); + const isTribeOwner = owner.publicKey === chat.ownerPubkey; + if (!isTribeOwner) + return; + timers.removeTimerByMsgId(id); + network.sendMessage({ + chat: chat, + sender: owner, + type: constants.message_types.delete, + message: { id, uuid }, + }); }); } exports.deleteMessage = deleteMessage; diff --git a/dist/api/controllers/messages.js.map b/dist/api/controllers/messages.js.map index 84b8194..f4773ab 100644 --- a/dist/api/controllers/messages.js.map +++ b/dist/api/controllers/messages.js.map @@ -1 +1 @@ -{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../api/controllers/messages.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAAgC;AAChC,yCAA8B;AAC9B,2CAAoC;AACpC,gCAAyC;AACzC,0CAAyC;AACzC,2CAA0C;AAC1C,sCAAqC;AACrC,sCAAsC;AACtC,0CAAyC;AACzC,mDAAgD;AAChD,6BAA4B;AAC5B,sCAAqC;AACrC,oCAAmC;AAEnC,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAC,6BAA6B,CAAC,CAAC,CAAA;AAE7E,MAAM,WAAW,GAAG,CAAO,GAAG,EAAE,GAAG,EAAE,EAAE;IACtC,MAAM,YAAY,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC;IAEpC,IAAI,CAAC,YAAY,EAAE;QAClB,OAAO,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;KAC/B;IACD,OAAO,CA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;aACf;YACD,MAAM,EAAE,OAAO;SAChB;KACD,CAAC,CAAC;IAEH,aAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;AACjB,CAAC,CAAA,CAAA;AAaC,oCAAY;AAXd,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;IAClC,eAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAA;IAErD,aAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;AACjB,CAAC,CAAA;AAMC,sCAAa"} \ No newline at end of file +{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../api/controllers/messages.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAAgC;AAChC,yCAA8B;AAC9B,2CAAoC;AACpC,gCAAyC;AACzC,0CAAyC;AACzC,2CAA0C;AAC1C,sCAAqC;AACrC,sCAAsC;AACtC,0CAAyC;AACzC,mDAAgD;AAChD,6BAA4B;AAC5B,sCAAqC;AACrC,oCAAmC;AAEnC,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAC,6BAA6B,CAAC,CAAC,CAAA;AAE7E,MAAM,WAAW,GAAG,CAAO,GAAG,EAAE,GAAG,EAAE,EAAE;IACtC,MAAM,YAAY,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC;IAEpC,IAAI,CAAC,YAAY,EAAE;QAClB,OAAO,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;KAC/B;IACD,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;IACzB,MAAM,KAAK,GAAG,MAAM,eAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC,CAAA;IACxE,mCAAmC;IAEnC,IAAI,gBAAgB,GAAG;QACtB,IAAI,EAAE,EAAE,CAA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