add viewed attribute to messages