The ruling ends a three-year legal battle in which X had argued it was not obliged to answer eSafety's questions