A California appeals court has rejected a student’s assertion that “making loud obscene noises” meant a fellow student in a school toilet had waived his right to not being videotaped and to have that video be posted to social media.

On Monday, the court upheld a misdemeanor conviction of that student, who used his mobile phone to take a video of a classmate as he masturbated – or jokingly pretended to masturbate – in the school bathroom.

The student doing the filming, identified as MH in court documents, posted the 10-second video to Snapchat and Vine. In spite of Snapchat videos only lasting 24 hours, the video went viral, spreading not only throughout the school but beyond, to other schools.

MH later told authorities that he just did it for the laughs. He thought it was funny that somebody was apparently masturbating in the bathroom.

According to the Daily Dot, the boy in the video, 14-year-old Matthew Burdette, was mercilessly bullied.

He killed himself in November 2013, writing in a suicide note that…

I can’t do school anymore. I have no friends. I don’t want to kill myself but I have no friends.

The footage only showed a closed bathroom stall. But Matthew’s distinctive shoes and socks were visible in the gap between the stall wall and the floor, court documents said.

Matthew had been facing the toilet, and he was, in fact, making moaning sounds. But a friend, Ezekiel, who’d been in another stall at the time, testified that he’d thought that Matthew had been joking.

He “was like that,” Ezekiel said in Monday’s ruling.

Like, he would just mess around.

According to the Daily Dot, MH, an 11th grader at the time, wasn’t in on the joke. He entered the bathroom and, hearing Matthew’s moans, whipped out his camera.

The video, taken inside the bathroom at University City High in San Diego County, was shot about 20 feet away from the bathroom stall, according to court documents.

MH later uploaded the video, writing in a caption something along the lines of “I think this dude is jacking off.”

However, MH only came to the attention of authorities when he confronted Ezekiel at Matthew’s funeral, threatening to “kick his a**” if he didn’t stop telling people he took the video.

Ezekiel alerted school officials. MH then confessed that he’d uploaded the video, telling the police that he “felt terrible for what had happened.”

San Diego prosecutors charged MH with invasion of privacy, and a court sentenced the boy to probation.

The conditions of his probation include social media restrictions, among other things. MH appealed, claiming that Matthew had no reasonable expectation of privacy in the bathroom stall because his distinctive shoes were visible under the stall’s wall and Matthew was audibly moaning, which anyone in the bathroom could have heard.

He also argued that there was a “newsworthy” defense that immunized him from criminal liability and that his First Amendment right to free speech was being violated.

MH had contested that his recording of Matthew was “a matter of concern to his school community,” in the “public interest,” and amounted to constitutionally protected “news gathering.”

He said that Matthew was engaged in an unlawful act of masturbating in public, and MH had caught him in the act.

The court dismissed those claims, noting that they hadn’t been made during the initial trial, and rarely do appellate courts deal with claims made on appeal that haven’t first been vetted at trial.

As far as privacy rights go, in its 24-page decision upholding the misdemeanor conviction, the court wrote:

A student in a high school bathroom stall reasonably expects he will not be videoed and have that video disseminated on social media. Matthew did not forfeit that right merely because his socks and shoes could be seen and his voice could be heard by others in the bathroom.

Matthew may have run the risk that people in the bathroom would tell others what they witnessed there. But that is a far cry from expecting his actions would be electronically recorded and broadcasted to the student body.