2011-02-03 04:38:43 +01:00
|
|
|
<?php
|
|
|
|
|
2012-03-10 00:46:25 +01:00
|
|
|
final class DifferentialInlineCommentPreviewController
|
2012-07-23 20:01:28 +02:00
|
|
|
extends PhabricatorInlineCommentPreviewController {
|
2011-02-03 04:38:43 +01:00
|
|
|
|
2015-03-28 01:08:31 +01:00
|
|
|
protected function loadInlineComments() {
|
|
|
|
$viewer = $this->getViewer();
|
2011-02-03 04:38:43 +01:00
|
|
|
|
2015-04-20 23:33:58 +02:00
|
|
|
$revision = id(new DifferentialRevisionQuery())
|
|
|
|
->setViewer($viewer)
|
|
|
|
->withIDs(array($this->getRevisionID()))
|
|
|
|
->executeOne();
|
|
|
|
if (!$revision) {
|
|
|
|
return array();
|
|
|
|
}
|
|
|
|
|
2015-03-28 01:08:31 +01:00
|
|
|
return id(new DifferentialInlineCommentQuery())
|
2015-04-20 23:33:58 +02:00
|
|
|
->setViewer($this->getViewer())
|
|
|
|
->withDrafts(true)
|
|
|
|
->withAuthorPHIDs(array($viewer->getPHID()))
|
|
|
|
->withRevisionPHIDs(array($revision->getPHID()))
|
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
2015-05-27 19:28:38 +02:00
|
|
|
->needHidden(true)
|
2015-03-28 01:08:31 +01:00
|
|
|
->execute();
|
2011-02-03 04:38:43 +01:00
|
|
|
}
|
|
|
|
|
2015-03-28 01:08:31 +01:00
|
|
|
protected function loadObjectOwnerPHID() {
|
|
|
|
$viewer = $this->getViewer();
|
2011-02-03 04:38:43 +01:00
|
|
|
|
2015-03-28 01:08:31 +01:00
|
|
|
$revision = id(new DifferentialRevisionQuery())
|
|
|
|
->setViewer($viewer)
|
|
|
|
->withIDs(array($this->getRevisionID()))
|
|
|
|
->executeOne();
|
|
|
|
if (!$revision) {
|
|
|
|
return null;
|
|
|
|
}
|
2011-02-03 04:38:43 +01:00
|
|
|
|
2015-03-28 01:08:31 +01:00
|
|
|
return $revision->getAuthorPHID();
|
2011-02-03 04:38:43 +01:00
|
|
|
}
|
|
|
|
|
2015-03-28 01:08:31 +01:00
|
|
|
|
|
|
|
private function getRevisionID() {
|
|
|
|
return $this->getRequest()->getURIData('id');
|
|
|
|
}
|
2011-02-03 04:38:43 +01:00
|
|
|
}
|