Creating a blocked user intercepter in Grails

Posted by UltraVi01 on Stack Overflow See other posts from Stack Overflow or by UltraVi01
Published on 2010-04-09T10:39:17Z Indexed on 2010/04/09 10:43 UTC
Read the original article Hit count: 198

Filed under:

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?

© Stack Overflow or respective owner

Related posts about grails