-
Notifications
You must be signed in to change notification settings - Fork 624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow message deletes from any platform #1991
base: master
Are you sure you want to change the base?
Conversation
@@ -466,7 +466,8 @@ func (gw *Gateway) SendMessage( | |||
|
|||
// exclude file delete event as the msg ID here is the native file ID that needs to be deleted | |||
if msg.Event != config.EventFileDelete { | |||
msg.ID = gw.getDestMsgID(rmsg.Protocol+" "+rmsg.ID, dest, channel) | |||
canonicalMsgID := gw.FindCanonicalMsgID(rmsg.Protocol, rmsg.ID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to be honest this is a bit of a hacky workaround and I don't necessarily like doing this pretty expensive operation on basically every message recived.
Hypothetically we can work around this
In practice this inefficiency would only matter in really large message caches (and we're mostly limited by I/O bandwidth).
I still don't really like it though.
I'd rather it be more of a graph-like structure where any message maps to the rest of the messages rather than 1 canonical message to the sent mesages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is less of an issue with the persistent message maps in #1996
What this should exatly do and do not do? I have this PR applied in my instance, but cannot observe any propagation of message deletions between a Whatsapp and Telegram group. Edit: And what the relation with #1986 is? Should I have that too applied for it to work? |
Yes you will have to have #1986 merged in as well as WhatsApp deletes wont propagate at all since those events are not handled. (telegram APIs dont have events for any message deletes so that's also inevitable.) In theory this should work as:
If you want to test this PR without merging #1986 as well |
I merged that PR. When I delete a message sent by myself from Whastapp, something seems to appear according to log, but it doesn't get deleted from Telegram. My bot should be admin. How could I troubleshoot this? |
Hmm, can you share the log that you said appears? Presumably if you send a message from WhatsApp, then delete it on WhatsApp, it will delete on telegram? |
To expand, this CR is a relatively simple hack in which when it gets all the corresponding message IDs with a message those are only stored as a map from original ("canonical") message -> messages[] In reality what we are doing is almost pretending the message delete came from the source platform (at least with regards to the message map.) In #1996 I have two separate maps, one to store the mapping of message -> canonical message and another that does canonical message -> messages[] |
Code Climate has analyzed commit 27c7b1e and detected 0 issues on this pull request. View more on Code Climate. |
Allow message deletes from any platform
This allows for message deletes to be synced from any of the gateway's channels, not just the "canonical"/source channel.
Note, the required changes in whatsappmulti handler depends on #1974
This is because when deleting a message that is not from the matterbridge user the sender jid is also required.