Bosses can get mad when staffers vent on social media about their jobs, but they may not be able to get even.

When one of Bert Martinez' employees posted gripes about her job and the boss on Facebook last year, the publicist consulted his lawyer, who said the staffer couldn't be fired.

"The first lesson I learned is, employees are allowed to vent," says Martinez, owner of Bert Martinez Communications in Phoenix. "If they're saying, hey, it's hard working here and I find this environment unpleasant, you can't fire them for that."

The employee quit a week after Martinez learned about the post.

The government protects workers' rights to say what they want about where they work, even if it's in a vitriolic and insulting tweet or post. It's illegal for an employee to be fired for an online post about working ­conditions, whether it's pay, hours, assignments, difficult supervisors, dress code, or any other gripe. So employers shouldn't try to restrict workers' freedom of speech or retaliate if there's a post they don't like.

It's a problem that companies of all sizes have to deal with, but it's often more challenging for smaller companies because they typically don't have large human resources departments or lawyers on staff to advise them.

What's protected

Workers who complain about employers on social media can't be fired if they're involved in what's called concerted activity, or joining with fellow staffers to improve working conditions, according to the National Labor Relations Board, the government agency responsible for upholding workers' rights.

"The NLRB is effectively taking the position that commentary about working conditions on social media is completely protected," says Henry Perlowski, an employment law attorney with Arnall Golden Gregory in Atlanta.

A 2014 NLRB decision shows how broadly the agency views employees' rights to make such critical posts, Perlowski says. The NLRB said a restaurant illegally fired two workers for taking part in a Facebook discussion of problems in how income tax was withheld from paychecks. The discussion mentioned a meeting about the issue. One employee was fired for a comment that contained an expletive describing one owner, and the other was dismissed for "liking" a post.

Because the posts were related to working conditions, and the employees were discussing concerted activity, or jointly seeking a resolution of their problems, the posts were protected. The NLRB reversed the firings.

Owners also can't resort to other disciplinary measures, Perlowski says. That rules out suspensions, reprimands, pay cuts and promotion denials.

… And what's not

The NLRB will uphold firings based on posts that damage a company, disparage its products or services or reveal trade secrets or financial information, says Paula Lopez, an employment law attorney with Allyn & Fortuna in New York. But there can be gray area, for example, when a post is critical of a company's services but is also related to working conditions.

Posts encouraging insubordination aren't protected, Lopez says, citing a 2014 case that upheld an employers' decision not to rehire workers who had posted plans to show up at the job and not do work.

Employees can also be fired for posting information about clients or customers. And if their posts are racist, homophobic, sexist or discriminate against a religion, companies should fire workers rather than be seen as tolerating or condoning the employees' views.

The NLRB has also said griping or insults by one employee that have no connection to working conditions are not protected. For example, one that ridicules the way the boss looks, dresses or speaks.

Joyce Rosenberg is a business reporter for the Associated Press.