mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-04-30 14:34:09 +02:00
Fix a broken workaround for DM notifications not showing if the convo is open
This commit is contained in:
parent
b5dccd6b91
commit
a310c5bcc1
@ -1485,14 +1485,30 @@
|
|||||||
//
|
//
|
||||||
// Block: Fix DM notifications not showing if the conversation is open.
|
// Block: Fix DM notifications not showing if the conversation is open.
|
||||||
//
|
//
|
||||||
if (ensurePropertyExists(TD, "services", "TwitterConversation", "prototype", "getUnreadChirps")){
|
if (ensurePropertyExists(TD, "vo", "Column", "prototype", "mergeMissingChirps")){
|
||||||
const prevFunc = TD.services.TwitterConversation.prototype.getUnreadChirps;
|
TD.vo.Column.prototype.mergeMissingChirps = prependToFunction(TD.vo.Column.prototype.mergeMissingChirps, function(e){
|
||||||
|
let model = this.model;
|
||||||
TD.services.TwitterConversation.prototype.getUnreadChirps = function(e){
|
|
||||||
return (e && e.sortIndex && !e.id && !this.notificationsDisabled)
|
if (model && model.state && model.state.type === "privateMe" && !this.notificationsDisabled && e.poller.feed.managed){
|
||||||
? this.messages.filter(t => t.chirpType === TD.services.ChirpBase.MESSAGE && !t.isOwnChirp() && !t.read && !t.belongsBelow(e)) // changed from belongsAbove
|
let unread = [];
|
||||||
: prevFunc.apply(this, arguments);
|
|
||||||
};
|
for(let chirp of e.chirps){
|
||||||
|
if (Array.isArray(chirp.messages)){
|
||||||
|
Array.prototype.push.apply(unread, chirp.messages.filter(message => message.read === false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unread.length > 0){
|
||||||
|
unread.sort(TD.util.chirpReverseColumnSort);
|
||||||
|
|
||||||
|
for(let message of unread){
|
||||||
|
onNewTweet(this, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO sound notifications are borked as well
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user