Mattermost, Inc.

Way to filter chat messages before they are displayed?

Is there a clean way to hook in a snippet of code that sees every post before it is allowed to show up?

Hi @hamzeh,

We do our rendering of posts inside of webapp/components/posts_view.jsx. Maybe take a look in there to see if that’s what you’re looking for? Be warned though that that file is in queue to be refactored.

I see, that file seems to be frontend, where as we’d like to process the post on the backend, before it gets to the point of being rendered. We’d like to put a handler on the backend that sees every single post and gets a chance to modify it or otherwise act with it, before it gets rendered.

So I am curious whether there are any tips for doing that cleanly.

You can take a look inside api/post.go and store/sql_post_store.go if you’d like to see the server code that deals with handling posts.