Skip to content

Commit

Permalink
fix chatapi.removeAllConversWithConversations()
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrea Sponziello committed Feb 13, 2024
1 parent 5edd542 commit 9306a13
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions chat21Api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ class Chat21Api {
* remove all the old conversations belonging to this group, on all users timelines
*/
removeAllConversWithConversations(app_id, convers_with, callback) {
// NOTE! THIS ARRIVES DIRECTLY ON THE CLIENT! REFACTOR WITH SOME "OBSERVER.APPS....ARCHIVE" TOPIC
this.chatdb.deleteConversationsByConversWith(convers_with, function (err, doc) {
logger.error("removeAllConversWithConversations()");
this.chatdb.deleteConversationsByConversWith(app_id, convers_with, function (err, doc) {
if (err) {
logger.error("Error deleting conversatios:", err);
callback(err);
Expand Down
3 changes: 3 additions & 0 deletions chatdb/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,16 @@ class ChatDB {
}

deleteConversationsByConversWith(app_id, convers_with, callback) {
console.log("deleteConversationsByConversWith()");
this.db.collection(this.instances_collection).deleteMany({app_id: app_id, conversWith: convers_with}, function(err, obj) {
if (err) {
console.error("deleteConversationsByConversWith() error", err);
if (callback) {
callback(err, null);
}
}
else {
console.error("deleteConversationsByConversWith() ok");
if (callback) {
callback(null, obj);
}
Expand Down

0 comments on commit 9306a13

Please sign in to comment.