Fix query for finding the next conversation

Whoops. The next conversation query was broken. Added a test to make sure everything is finally working. My bad.