TNS-17Recommended
Let people block and mute other users
Let every user block another user, which stops that user's messages, replies, mentions, tags and group invites to them. Let them mute a user too, which only hides that user's posts from their own view.
How to do it
A report asks you to act, while a block lets the person protect themselves at once. The Commission's guidelines on protecting minors ask that children can block and mute any user. They also ask that nobody can add a child to a group without the child's consent. Offer both actions on every profile, message and post. Check blocks on the server in every path that carries content between two users, including search and suggestions. The blocked user sees the same as for a private account, and is never told. Keep a block until the user lifts it, and include the list in the data export. The report form of Put a report button on every piece of user content offers a block in the same step.
Examples
JavaScript example
export async function canReach(senderId, recipientId) {
return !(await blocks.exists({ blockerId: recipientId, blockedId: senderId }));
}
app.post('/messages', async (req, res) => {
if (!(await canReach(req.user.id, req.body.recipientId))) return res.status(404).end();
res.status(201).json(await messages.create(req.user.id, req.body));
});
Python example
def can_reach(sender_id: int, recipient_id: int) -> bool:
return not blocks.exists(blocker_id=recipient_id, blocked_id=sender_id)
@app.post("/messages", status_code=201)
def send_message(body: MessageBody, user: User = Depends(current_user)):
if not can_reach(user.id, body.recipient_id):
raise HTTPException(404)
return messages.create(user.id, body)
How to check
A test has user A block user B. B's message, reply, mention, tag and group invite to A each fail, and A's feed and search show nothing from B. B's view of A shows no sign of a block. After A mutes user C instead, C's posts leave A's feed and C can still reply.
Sources
Related rules
- TNS-1 Put a report button on every piece of user content in Trust and safety
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/trust-and-safety/reports-and-queues/block-and-mute">Agent Wranglers trust and safety playbook</a>. In code you write, add a comment next to it with the same link.