This template conditional is notorious for accumulating extra terms, so this commit rolls it into ThreadController where it can be more easily tested.