Allow inline comments to be individually hidden
Summary:
Ref T7447. Implements per-viewer comment hiding. Once a comment is obsolete or uninteresting, you can hide it completely.
This is sticky per-user.
My hope is that this will strike a better balance between concerns than some of the other approaches (conservative porting, summarization, hide-all).
Specifically, this adds a new action here:
{F435621}
Clicking it completely collapses the comment into a small icon on the previous line, and saves the comment state as hidden for you:
{F435626}
You can click the icon to reveal all hidden comments below the line.
Test Plan:
- Hid comments.
- Showed comments.
- Created, edited, deleted and submitted comments.
- Used Diffusion comments (hiding is not implemented there yet, but I'd plan to bring it there eventually if it works out in Differential).
Reviewers: btrahan, chad
Reviewed By: btrahan
Subscribers: jparise, yelirekim, epriestley
Maniphest Tasks: T7447
Differential Revision: https://secure.phabricator.com/D13009
This commit is contained in:
@@ -191,6 +191,7 @@ final class DifferentialChangesetViewController extends DifferentialController {
|
||||
if ($revision) {
|
||||
$query = id(new DifferentialInlineCommentQuery())
|
||||
->setViewer($viewer)
|
||||
->needHidden(true)
|
||||
->withRevisionPHIDs(array($revision->getPHID()));
|
||||
$inlines = $query->execute();
|
||||
$inlines = $query->adjustInlinesForChangesets(
|
||||
|
||||
@@ -42,6 +42,7 @@ final class DifferentialInlineCommentEditController
|
||||
->setViewer($this->getViewer())
|
||||
->withIDs(array($id))
|
||||
->withDeletedDrafts(true)
|
||||
->needHidden(true)
|
||||
->executeOne();
|
||||
}
|
||||
|
||||
@@ -50,6 +51,7 @@ final class DifferentialInlineCommentEditController
|
||||
->setViewer($this->getViewer())
|
||||
->withPHIDs(array($phid))
|
||||
->withDeletedDrafts(true)
|
||||
->needHidden(true)
|
||||
->executeOne();
|
||||
}
|
||||
|
||||
@@ -152,4 +154,38 @@ final class DifferentialInlineCommentEditController
|
||||
return $this->loadRevision()->getAuthorPHID();
|
||||
}
|
||||
|
||||
protected function hideComments(array $ids) {
|
||||
$viewer = $this->getViewer();
|
||||
$table = new DifferentialHiddenComment();
|
||||
$conn_w = $table->establishConnection('w');
|
||||
|
||||
$sql = array();
|
||||
foreach ($ids as $id) {
|
||||
$sql[] = qsprintf(
|
||||
$conn_w,
|
||||
'(%s, %d)',
|
||||
$viewer->getPHID(),
|
||||
$id);
|
||||
}
|
||||
|
||||
queryfx(
|
||||
$conn_w,
|
||||
'INSERT IGNORE INTO %T (userPHID, commentID) VALUES %Q',
|
||||
$table->getTableName(),
|
||||
implode(', ', $sql));
|
||||
}
|
||||
|
||||
protected function showComments(array $ids) {
|
||||
$viewer = $this->getViewer();
|
||||
$table = new DifferentialHiddenComment();
|
||||
$conn_w = $table->establishConnection('w');
|
||||
|
||||
queryfx(
|
||||
$conn_w,
|
||||
'DELETE FROM %T WHERE userPHID = %s AND commentID IN (%Ld)',
|
||||
$table->getTableName(),
|
||||
$viewer->getPHID(),
|
||||
$ids);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ extends PhabricatorInlineCommentPreviewController {
|
||||
->withDrafts(true)
|
||||
->withAuthorPHIDs(array($viewer->getPHID()))
|
||||
->withRevisionPHIDs(array($revision->getPHID()))
|
||||
->needHidden(true)
|
||||
->execute();
|
||||
}
|
||||
|
||||
|
||||
@@ -175,6 +175,7 @@ final class DifferentialRevisionViewController extends DifferentialController {
|
||||
|
||||
$query = id(new DifferentialInlineCommentQuery())
|
||||
->setViewer($user)
|
||||
->needHidden(true)
|
||||
->withRevisionPHIDs(array($revision->getPHID()));
|
||||
$inlines = $query->execute();
|
||||
$inlines = $query->adjustInlinesForChangesets(
|
||||
|
||||
Reference in New Issue
Block a user