The high court overturned an injunction that would have placed limits on contact between government officials and social media companies on a series of issues.