Skip to content
Snippets Groups Projects
Commit 07129f10 authored by Xavier Ferrer de la Penyita's avatar Xavier Ferrer de la Penyita
Browse files

prevent self messages from triggering unreadStatus or notifications

parent 81047250
No related branches found
No related tags found
2 merge requests!72Bring back first draw of RAI fix + settings changes for "-2",!71Prevent self messages from triggering unreadStatus or notifications
......@@ -152,17 +152,32 @@
// Listen for incoming RAI from the server
_converse.connection.addHandler(function (message) {
message.querySelectorAll('activity').forEach(function (activity)
{
if (activity && activity.namespaceURI == "xmpp:prosody.im/protocol/rai")
{
const jid = activity.textContent;
setUnreadStatus(jid, true);
emitNotification(jid);
const from_jid = message.attributes.from?.nodevalue
const room_jid = from_jid?.split("/")[0]
const room = '';
let ignore = false;
for (let i = 0; i < _converse.chatboxes.models.length; i++){
if(_converse.chatboxes.models[i].id === room_jid){
room = _converse.chatboxes.models[i].id;
break;
}
});
return true;
}
if (room && from_jid && room_jid){
if (from_jid === room_jid+'/'+room.get('nick')){
ignore = true;
}
}
if(message && !ignore)
message.querySelectorAll('activity').forEach(function (activity)
{
if (activity && activity.namespaceURI == "xmpp:prosody.im/protocol/rai")
{
const jid = activity.textContent;
setUnreadStatus(jid, true);
emitNotification(jid);
}
});
return true;
}, null, 'message');
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment