Browse Source

destroy ChatMember records on delete chat

push-params
Evan Feenstra 4 years ago
parent
commit
bcfeb34cfb
  1. 1
      dist/src/controllers/chats.js
  2. 2
      dist/src/controllers/chats.js.map
  3. 5
      dist/src/network/receive.js
  4. 2
      dist/src/network/receive.js.map
  5. 4
      dist/src/network/send.js
  6. 2
      dist/src/network/send.js.map
  7. 1
      src/controllers/chats.ts
  8. 5
      src/network/receive.ts
  9. 4
      src/network/send.ts

1
dist/src/controllers/chats.js

@ -310,6 +310,7 @@ exports.deleteChat = (req, res) => __awaiter(void 0, void 0, void 0, function* (
name: '' name: ''
}); });
yield models_1.models.Message.destroy({ where: { chatId: id } }); yield models_1.models.Message.destroy({ where: { chatId: id } });
yield models_1.models.ChatMember.destroy({ where: { chatId: id } });
res_1.success(res, { chat_id: id }); res_1.success(res, { chat_id: id });
}); });
function receiveGroupJoin(payload) { function receiveGroupJoin(payload) {

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

File diff suppressed because one or more lines are too long

5
dist/src/network/receive.js

@ -40,7 +40,10 @@ const typesThatNeedPricePerMessage = [
msgtypes.message, msgtypes.attachment msgtypes.message, msgtypes.attachment
]; ];
exports.typesToReplay = [ exports.typesToReplay = [
msgtypes.message, msgtypes.group_join, msgtypes.group_leave msgtypes.message,
msgtypes.group_join,
msgtypes.group_leave,
msgtypes.bot_res,
]; ];
const botTypes = [ const botTypes = [
constants.message_types.bot_install, constants.message_types.bot_install,

2
dist/src/network/receive.js.map

File diff suppressed because one or more lines are too long

4
dist/src/network/send.js

@ -94,7 +94,7 @@ function sendMessage(params) {
mqttTopic = ''; // FORCE KEYSEND!!! mqttTopic = ''; // FORCE KEYSEND!!!
} }
const m = yield msg_1.personalizeMessage(msg, contact, isTribeOwner); const m = yield msg_1.personalizeMessage(msg, contact, isTribeOwner);
console.log('-> personalized msg', m); // console.log('-> personalized msg',m)
const opts = { const opts = {
dest: destkey, dest: destkey,
data: m, data: m,
@ -135,7 +135,7 @@ function signAndSend(opts, mqttTopic, replayingHistory) {
opts.amt = opts.amt || 0; opts.amt = opts.amt || 0;
const sig = yield signer.signAscii(data); const sig = yield signer.signAscii(data);
data = data + sig; data = data + sig;
console.log("-> ACTUALLY SEND: topic:", mqttTopic); // console.log("-> ACTUALLY SEND: topic:", mqttTopic)
try { try {
if (mqttTopic) { if (mqttTopic) {
yield tribes.publish(mqttTopic, data, function () { yield tribes.publish(mqttTopic, data, function () {

2
dist/src/network/send.js.map

File diff suppressed because one or more lines are too long

1
src/controllers/chats.ts

@ -315,6 +315,7 @@ export const deleteChat = async (req, res) => {
name:'' name:''
}) })
await models.Message.destroy({ where: { chatId: id } }) await models.Message.destroy({ where: { chatId: id } })
await models.ChatMember.destroy({ where: {chatId: id} })
success(res, { chat_id: id }) success(res, { chat_id: id })
} }

5
src/network/receive.ts

@ -32,7 +32,10 @@ const typesThatNeedPricePerMessage = [
msgtypes.message, msgtypes.attachment msgtypes.message, msgtypes.attachment
] ]
export const typesToReplay=[ // should match typesToForward export const typesToReplay=[ // should match typesToForward
msgtypes.message, msgtypes.group_join, msgtypes.group_leave msgtypes.message,
msgtypes.group_join,
msgtypes.group_leave,
msgtypes.bot_res,
] ]
const botTypes=[ const botTypes=[
constants.message_types.bot_install, constants.message_types.bot_install,

4
src/network/send.ts

@ -93,7 +93,7 @@ export async function sendMessage(params) {
} }
const m = await personalizeMessage(msg, contact, isTribeOwner) const m = await personalizeMessage(msg, contact, isTribeOwner)
console.log('-> personalized msg',m) // console.log('-> personalized msg',m)
const opts = { const opts = {
dest: destkey, dest: destkey,
data: m, data: m,
@ -131,7 +131,7 @@ export function signAndSend(opts, mqttTopic?:string, replayingHistory?:boolean){
const sig = await signer.signAscii(data) const sig = await signer.signAscii(data)
data = data + sig data = data + sig
console.log("-> ACTUALLY SEND: topic:", mqttTopic) // console.log("-> ACTUALLY SEND: topic:", mqttTopic)
try { try {
if(mqttTopic) { if(mqttTopic) {
await tribes.publish(mqttTopic, data, function(){ await tribes.publish(mqttTopic, data, function(){

Loading…
Cancel
Save