Skip to content
This repository has been archived by the owner on Dec 16, 2019. It is now read-only.

Commit

Permalink
Temporary fix empty messages diplay in conversation
Browse files Browse the repository at this point in the history
These messages are events like nickname change.
The permanent fix will come from the facebook-chat-api library
Related issue: Schmavery/facebook-chat-api#313
  • Loading branch information
KillianKemps committed Nov 19, 2016
1 parent e17f034 commit 9227c15
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,11 @@ function getFBThreadHistory(decoded, users, socket, threadID) {
return new Promise(function (resolve, reject) {
currentUser.fbApi.getThreadHistory(threadID, 0, 10, '', function (err, data) {
if(err) return console.error(err);
socket.emit('return/threadHistory', data);
resolve(data);
const filtered_data = data.filter(function(msg) {
return msg.body || msg.attachments.length > 0;
});
socket.emit('return/threadHistory', filtered_data);
resolve(filtered_data);
});
});
})().catch(function(err) {
Expand Down

0 comments on commit 9227c15

Please sign in to comment.