For any given thread, we need to allow participants to view the pinned messages. The query checks for messages where m.pinned = 1 and translates the rows into messageInfos using an existing function. I use shimUnsupportedRawMessageInfos to prevent problems if there is a pinned message of a newer message type that an older client does not yet support.
Depends on D6930