The two had sued the Justice Department over a 2017 episode in which officials shared copies with reporters of text messages they had sent to each other, including ones that described former President Trump as an idiot and a loathsome human.