To prevent violence at work, many employers prohibit even indirect threats. That’s perfectly legal.
Recent case: When Karl got together with some co-workers on break, he pulled a bullet out of his pocket. Someone asked if it was real and Karl said it was, adding, “This one’s got your name on it.” He was fired for violating a policy against threats or violence.
He sued, alleging race discrimination. But he couldn’t find anyone who had broken the same rule who hadn’t been fired. His case was dismissed. (Wawarosky v. Fast Group, No. 01-13-00466, Court of Appeals of Texas, 2015)