Criterias To Apply Sadd-E-Zariya Principle
There is no hard and fast rule. A scholar will give his advice and support his advice with arguments from the holistic framework of Quran and Sunnah. If you agree with his arguments then follow it and if not, then don’t. The example you quoted is very individualistic in nature and may vary from person to person based on their friendhip experience. You can decide for yourself what you wanna do in this regard, there is no hard and fast rule. The bottomline is that you need to stay away from comitting major sins at all costs.
The office is not an alone place. As I said, attempting minor sin stays minor.