Action event (client side) for creating and updating posts
-
$(window).on('action:chat.received', function(data) { $(document).ready(function() { console.log('hook triggered'); previewLinks() }); });
I guess check if the hook is triggered with a console.log, if it's triggered gotto take a look in previewLinks to see why it's not working.
-
@baris Seems it does trigger according to the console log, although the resultant output is unexpected in the sense that it works fine for posts, but not for chat.
In this use case, I am polling an Open Graph proxy server, and getting the below in chat, but not in posts where it works fine
Access to fetch from origin [origin] has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Equally, on chat reload (F5), it works fine.
-
@baris just circling back on this thread. I'm working on my threading applet for chat messages now that the topic/post version is mature, and everything is working on load, but not for the below
$(window).on('action:chat.received', function(data) { $(document).ready(function() { console.log('hook triggered'); threadedChat(); }); });
The console message does not fire when new data/posts are being added to the chat window.
Any thoughts ?
This one works fine on load
$(window).on('action:chat.loaded', function(data) { $(document).ready(function() { threadedChat(); }); });
-
@phenomlab I tested the below and it is firing when I send messages.
$(window).on('action:chat.received', function(data) { console.log('hook triggered'); });
That hook is correct
https://github.com/NodeBB/NodeBB/blob/master/public/src/client/chats/messages.js#L107
so there must be another issue if you are not seeing the logs. -
@baris said in Action event (client side) for creating and updating posts:
I tested the below and it is firing when I send messages.
Ok, but does it fire when older messages are being pulled into the chat? Find a chat session with a long thread and scroll up to load more and see if it fires then.