[1.8] Fixed messages not being added to the chat history

1.8 version of #1581