Fix reactions in threads sometimes causing stuck notifications (#3146)
* Associate event with thread before adding it to the thread timeline
* Make sure events can be added to thread correctly
* Write initial test case
* Add additional comment for why the code had to be reordered