Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem summary:
1. Sent messages are not showing in the chatbox / message thread page.
2. The receiver is not getting the sent messages until he/she refreshed the page.
Comment | File | Size | Author |
---|---|---|---|
#5 | refresh-privatemsg-panel-submit-2744537-5.patch | 4.64 KB | monstrfolk |
Comments
Comment #2
stoickthevast CreditAttribution: stoickthevast as a volunteer commentedNoticed that even in the demo site the message is not showing as well after sending.
Comment #3
kopeboy CreditAttribution: kopeboy commentedYeah, just tested, you need at least a page request.
Comment #4
Hardik Rawal CreditAttribution: Hardik Rawal as a volunteer commentedAny resolution for this ?
Comment #5
monstrfolk CreditAttribution: monstrfolk commentedPatch for the message list to update after sending a message. This does not work in the mini chat box yet. This patch is for 7.2.x-dev. Might work on the other branches.
Comment #6
monstrfolk CreditAttribution: monstrfolk commentedComment #7
monstrfolk CreditAttribution: monstrfolk commentedComment #8
monstrfolk CreditAttribution: monstrfolk commentedComment #9
Oscartt CreditAttribution: Oscartt commentedI have sort of figured out what the problem is atleast in 7x.1x.dev. For me the messages were not showing up in the minichat while I was on any other than the message thread page.
That's where the channels are "opened" in order for the minichat to work. As you can see, that hook is only fired when viewing the thread page. Thus, the channels are never opened on any other page even if the minichat is open and no messages can be received.
A partial fix is to put this after line 28 on privatemsg_nodejs.module:
That does the trick, but there's a catch. If you receive a message let's say on the frontpage and click open mini chat on the alert, that code still isn't fired and you won't see the messages you type in. Only after you open the minichat and refresh the page, that code opens the channels and everything works nicely as long as you keep the minichat open while browsing the site.
To work around that catch and make the minichat somewhat usable, I removed the "Open minichat" link from the alert, so it can only be opened from the thread page. This way, if you go to the thread and click open minichat, the channels are already opened by the "privatemsg_nodejs_privatemsg_view_alter" and will continue to stay open due to the added foreach if you navigate elsewhere with the minichat open.
So the real fix to make this work 100% is to somehow send the channel tokens from the javascript when the minichat is opened. I tried for 2 days to get that to work, but I don't really undertand javascript and nodejs enough to make it happen. I think it should be fairly simple if one knew what they were doing.