There are many cases where it is clear ethically and legally what can be said/done with coworkers of any sex - this is one of the cases where the person's behaviour was clearly wrong: https://news.ycombinator.com/item?id=9178681
However, there also some other situation in the modern workplaces where you can find yourself in the legal/ethical grey zone. For example: you gradually become friends with your coworkers, start spending time together doing things outside of your work context. You can end up hanging out privately with your superiors or subordinates and this can eventually lead to various personal and romantic entanglements.
The legal advice would be: don't. But, the modern workplace culture encourages being more then 'professional coworker' to your coworkers outside of the office. And I personally think it is a good thing because it makes workplaces more human. I certainly made some amazing friends (both male and female) at the places where I worked.
But, my question is: has anybody with legal and/or HR credentials and some ethical sense written any definitive guide what is OK and what is not specifically in the context of the modern office?