In future diffs, we're going to need to change how some filters are constructed based on the presence of other filters. In particular, if we are filtering for a particular user's visible threads, we'll want to apply further threadID filters as mm.thread IN rather than t.id IN.
To reduce the complexity of building these filters at the callsite, I'm replacing them with a filter object, and moving the responsibility of building the WHERE clause to fetchServerThreadInfos and fetchThreadInfos.
Depends on D8512