- if @message.to_user_id == current_user.id || @message.from_user_id == current_user.id
- @message.message_read = true if @message.to_user_id == current_user.id
+ if @message.recipient == current_user || @message.sender == current_user
+ @message.message_read = true if @message.recipient == current_user