Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14099739
D19633.id46924.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D19633.id46924.diff
View Options
diff --git a/src/applications/differential/controller/DifferentialInlineCommentEditController.php b/src/applications/differential/controller/DifferentialInlineCommentEditController.php
--- a/src/applications/differential/controller/DifferentialInlineCommentEditController.php
+++ b/src/applications/differential/controller/DifferentialInlineCommentEditController.php
@@ -77,19 +77,17 @@
}
protected function loadCommentForEdit($id) {
- $request = $this->getRequest();
- $user = $request->getUser();
+ $viewer = $this->getViewer();
$inline = $this->loadComment($id);
- if (!$this->canEditInlineComment($user, $inline)) {
+ if (!$this->canEditInlineComment($viewer, $inline)) {
throw new Exception(pht('That comment is not editable!'));
}
return $inline;
}
protected function loadCommentForDone($id) {
- $request = $this->getRequest();
- $viewer = $request->getUser();
+ $viewer = $this->getViewer();
$inline = $this->loadComment($id);
if (!$inline) {
@@ -128,11 +126,11 @@
}
private function canEditInlineComment(
- PhabricatorUser $user,
+ PhabricatorUser $viewer,
DifferentialInlineComment $inline) {
// Only the author may edit a comment.
- if ($inline->getAuthorPHID() != $user->getPHID()) {
+ if ($inline->getAuthorPHID() != $viewer->getPHID()) {
return false;
}
diff --git a/src/applications/diffusion/controller/DiffusionInlineCommentController.php b/src/applications/diffusion/controller/DiffusionInlineCommentController.php
--- a/src/applications/diffusion/controller/DiffusionInlineCommentController.php
+++ b/src/applications/diffusion/controller/DiffusionInlineCommentController.php
@@ -50,19 +50,17 @@
}
protected function loadCommentForEdit($id) {
- $request = $this->getRequest();
- $user = $request->getUser();
+ $viewer = $this->getViewer();
$inline = $this->loadComment($id);
- if (!$this->canEditInlineComment($user, $inline)) {
+ if (!$this->canEditInlineComment($viewer, $inline)) {
throw new Exception(pht('That comment is not editable!'));
}
return $inline;
}
protected function loadCommentForDone($id) {
- $request = $this->getRequest();
- $viewer = $request->getUser();
+ $viewer = $this->getViewer();
$inline = $this->loadComment($id);
if (!$inline) {
@@ -86,11 +84,11 @@
}
private function canEditInlineComment(
- PhabricatorUser $user,
+ PhabricatorUser $viewer,
PhabricatorAuditInlineComment $inline) {
// Only the author may edit a comment.
- if ($inline->getAuthorPHID() != $user->getPHID()) {
+ if ($inline->getAuthorPHID() != $viewer->getPHID()) {
return false;
}
diff --git a/src/infrastructure/diff/PhabricatorInlineCommentController.php b/src/infrastructure/diff/PhabricatorInlineCommentController.php
--- a/src/infrastructure/diff/PhabricatorInlineCommentController.php
+++ b/src/infrastructure/diff/PhabricatorInlineCommentController.php
@@ -88,7 +88,7 @@
public function processRequest() {
$request = $this->getRequest();
- $user = $request->getUser();
+ $viewer = $this->getViewer();
$this->readRequestParameters();
@@ -221,7 +221,7 @@
$inline = $this->createComment()
->setChangesetID($this->getChangesetID())
- ->setAuthorPHID($user->getPHID())
+ ->setAuthorPHID($viewer->getPHID())
->setLineNumber($this->getLineNumber())
->setLineLength($this->getLineLength())
->setIsNewFile($this->getIsNewFile())
@@ -313,10 +313,10 @@
private function buildEditDialog() {
$request = $this->getRequest();
- $user = $request->getUser();
+ $viewer = $this->getViewer();
$edit_dialog = id(new PHUIDiffInlineCommentEditView())
- ->setUser($user)
+ ->setUser($viewer)
->setSubmitURI($request->getRequestURI())
->setIsOnRight($this->getIsOnRight())
->setIsNewFile($this->getIsNewFile())
@@ -342,22 +342,22 @@
$on_right) {
$request = $this->getRequest();
- $user = $request->getUser();
+ $viewer = $this->getViewer();
$engine = new PhabricatorMarkupEngine();
- $engine->setViewer($user);
+ $engine->setViewer($viewer);
$engine->addObject(
$inline,
PhabricatorInlineCommentInterface::MARKUP_FIELD_BODY);
$engine->process();
- $phids = array($user->getPHID());
+ $phids = array($viewer->getPHID());
$handles = $this->loadViewerHandles($phids);
$object_owner_phid = $this->loadObjectOwnerPHID($inline);
$view = id(new PHUIDiffInlineCommentDetailView())
- ->setUser($user)
+ ->setUser($viewer)
->setInlineComment($inline)
->setIsOnRight($on_right)
->setMarkupEngine($engine)
@@ -378,7 +378,7 @@
private function renderTextArea($text) {
return id(new PhabricatorRemarkupControl())
- ->setUser($this->getRequest()->getUser())
+ ->setViewer($this->getViewer())
->setSigil('differential-inline-comment-edit-textarea')
->setName('text')
->setValue($text)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 27, 12:26 PM (18 h, 52 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6794158
Default Alt Text
D19633.id46924.diff (4 KB)
Attached To
Mode
D19633: Update some inline comment logic to use more modern "Viewer"-oriented calls/variables
Attached
Detach File
Event Timeline
Log In to Comment