There was a mismatch between flow types and actual object returned by fetchMediaForThread. Instead of returning string ids it returned numbers. This diff changes all the ids to strings before returning them. On the client side the id was only used as keys and was converted to string so there should be no changes in behaviour.
Depends on D7685