[FIX] Delete messages (#1399)
This commit is contained in:
parent
e17291960d
commit
29302ccd08
|
@ -6,7 +6,7 @@ import log from '../../utils/log';
|
||||||
import database from '../database';
|
import database from '../database';
|
||||||
import protectedFunction from './helpers/protectedFunction';
|
import protectedFunction from './helpers/protectedFunction';
|
||||||
|
|
||||||
export default function updateMessages({ rid, update, remove }) {
|
export default function updateMessages({ rid, update = [], remove = [] }) {
|
||||||
try {
|
try {
|
||||||
if (!((update && update.length) || (remove && remove.length))) {
|
if (!((update && update.length) || (remove && remove.length))) {
|
||||||
return;
|
return;
|
||||||
|
@ -22,7 +22,7 @@ export default function updateMessages({ rid, update, remove }) {
|
||||||
console.log('updateMessages: subscription not found');
|
console.log('updateMessages: subscription not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
const messagesIds = update.map(m => m._id);
|
const messagesIds = [...update.map(m => m._id), ...remove.map(m => m._id)];
|
||||||
const msgCollection = db.collections.get('messages');
|
const msgCollection = db.collections.get('messages');
|
||||||
const threadCollection = db.collections.get('threads');
|
const threadCollection = db.collections.get('threads');
|
||||||
const threadMessagesCollection = db.collections.get('thread_messages');
|
const threadMessagesCollection = db.collections.get('thread_messages');
|
||||||
|
|
Loading…
Reference in New Issue