Skip to content
Source
Sign inSign up

Hide or delete a comment

Issues and pull requests / Issues

Hide or delete a comment

A comment is spam, off-topic or out of date, and it pulls the thread away from the work. Hide it, so that readers see a folded bar with the reason. Or delete it, so that it is gone for everyone.

4 min read

Who can do what:

  • Hide and unhide: the triage role or more.
  • Delete: the author of the comment, or the triage role or more.

Each comment has its own id. To get it in a terminal, run src issue view 12 --json comments.

1. Hide a comment

  1. Open the issue or the pull request.
  2. On the comment, click the menu (the three dots), then Hide comment.
  3. In Reason, pick a reason.
  4. Click Hide comment.

In a terminal, run:

src comment hide 345 --reason off_topic

A reason is spam, abuse, off_topic, outdated, duplicate or resolved. To change the reason, hide the comment again with the new reason.

The comment now shows folded, with the text This comment was hidden as off-topic. Each reader can click Show to read it.

2. Unhide it later

On the folded comment, click the menu, then Unhide comment. In a terminal, run:

src comment unhide 345

3. Delete a comment

  1. On the comment, click the menu, then Delete comment.
  2. In the dialog, click Delete comment.

In a terminal, run:

src comment delete 345 --yes

To delete your own newest comment, run src issue comment 12 --delete-last --yes, or src pr comment 7 --delete-last --yes on a pull request. src never asks a question, so it needs --yes.

Caution

A deleted comment does not come back. Its earlier versions go with it.

What stays after a delete:

  • A line thread: when its first comment has replies, the replies stay. The first comment shows This comment was deleted.
  • A review: it keeps its verdict, for example an approval. Only its text goes.
  • The timeline: when you delete the comment of another person, it shows a line such as "alice deleted a comment from bob". It never shows the text.

On a repository that syncs with GitHub

  • A delete: it goes to GitHub too, with your own GitHub account.
  • No GitHub connection: the comment is deleted here only. The page says Deleted here only: GitHub keeps this comment, because you have not connected GitHub for sync. Delete it on GitHub too. To connect, see Connect GitHub.
  • A hide: it stays here. On GitHub, the comment does not change.
  • Agents: an agent cannot delete a comment that is on GitHub.

When you cannot hide or delete

  • A locked conversation: only people with write access delete comments there. See Lock a heated conversation.
  • No connection: on items created in Source, a delete, a hide and an unhide are saved in the browser. They go to the server when you are online again. See Change issues while offline.

Done

  • A hidden comment shows folded, with its reason, and every reader can still open it.
  • A deleted comment is gone for everyone, with its earlier versions.
  • The timeline shows who deleted the comment of another person.

To remove only an old version of a comment, for example one that holds a password, see Delete an earlier version.

Later: REST and MCP

An agent or a script hides and deletes comments with the same rules. The REST paths are under /api/v1/repos/{owner}/{repo}.

You want toRESTMCP toolsrc
Hide a commentPOST /issues/comments/{id}/hide, with { "reason" }hide_commentsrc comment hide 345 --reason spam
Unhide a commentDELETE /issues/comments/{id}/hideunhide_commentsrc comment unhide 345
Delete a commentDELETE /issues/comments/{id}delete_commentsrc comment delete 345 --yes
  • The comment routes work for the comments of pull requests too: review summaries, line comments and replies.
  • DELETE /issues/comments/{id} answers { "ok": true, "notice": null }. On a repository that syncs with GitHub, notice has the text above when GitHub keeps the comment.
  • A route answers 404 when the comment does not exist, and 403 when you cannot act on it.

Use the REST API has the other routes.