Closed NikV closed 9 years ago
You can trigger a delete using datamcflyRef.remove('id of document');
to make it work first, you'd have to query all threads that were part of that individual chat then remove it. So since we group the conversation by the initial fromNumber
, you could do something like this:
datamcflyRef.where({'fromNumber':NUMBER}).on("value", function(snapshot) {
snapshot.forEach( function(chat){
datamcflyFef.remove( chat.value()._id, function( removed ) {
console.log('Deleted Document : ', removed.value() );
});
});
});
Thanks for the function! Where would I put this in the code?
You could put it into the chatmanager, you may have to make a few changes to it though as the reference is this.datamcflyRef I think
Made the changes, but seems like it gives an error everywhere I put it in chatmanger.
Can you share your chatmanager and I'll take a look? :)
Right now, it currently looks the same as the one in this github repo :)
Ok, you can take a look at this file and go from there https://gist.github.com/freekrai/71de95a4b05b8a48854f
It may a tad rough as I didn't have a chance to test it as I'm mobile this morning :)
Getting closer! Getting an error though on 113: Cannot read property 'remove' of undefined
.remove
is definitely a function in the library, so try now with the latest push.
Just changed the this.datamcflyRef
to _this.datamcflyRef
Where did you change that? No change if I replace the normal this. before the remove()
Look at the gist...
Woops, sorry, I see that!
What would be the best way to delete an individual chat with a user?