Creating a blocked user intercepter in Grails
- by UltraVi01
I am working on a social site where users can block other users. Throughout the site --dozens of places, user information is displayed. For example, user comments, reply forms, online user list.. etc etc.. The problem is that given the high number of places user info is displayed, it's becoming very difficult to check each time if that user is blocked. For example:
<g:each var="comment" in="${comments}">
<g:if test="!${loggedInUser.blockedUsers.find { it == comment.user}">
show comment
</g:if>
</g:each>
Does Grails provide any functionality that would facilitate creating some kind of filter or intercepter where I could simply exclude blocked users when iterating lists, etc? If not, what would you suggest I do?