MAIN-2727 Fix call to setPostedAsBot() on non-object

I introduced a refactoring error in a7ac26f2. This commit addresses that error and adds a test to make sure the correct object is passed through the call stack.

/cc @grunny @michalroszka