Her friends found out about Draco at the very end, during the Battle of Hogwarts. It was especially bad for Ron, as he tried to kiss her after they had destroyed the horcrux in the chamber of secrets.