Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

differential: add ReviewHelper boilerplate (bug 1879230) #41

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions moz-extensions/src/__phutil_library_map__.php
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@
'DifferentialUpliftRequestCustomFieldTestCase' => 'differential/customfield/__tests__/DifferentialUpliftRequestCustomFieldTestCase.php',
'PhabricatorUpdateUpliftCommentAction' => 'applications/transactions/commentaction/PhabricatorUpdateUpliftCommentAction.php',
'DifferentialRevisionWarning' => 'differential/view/DifferentialRevisionWarning.php',
'DifferentialReviewHelper' => 'differential/view/DifferentialReviewHelper.php',
'EmailAPIAuthorization' => 'email/EmailAPIAuthorization.php',
'EmailAffectedFile' => 'email/model/EmailAffectedFile.php',
'EmailBug' => 'email/model/EmailBug.php',
@@ -129,6 +130,7 @@
'DifferentialUpliftRequestCustomField' => 'DifferentialStoredCustomField',
'PhabricatorUpdateUpliftCommentAction' => 'PhabricatorEditEngineCommentAction',
'DifferentialRevisionWarning' => 'Phobject',
'DifferentialReviewHelper' => 'Phobject',
'EmailRevisionAbandoned' => 'PublicEmailBody',
'EmailRevisionAccepted' => 'PublicEmailBody',
'EmailRevisionClosed' => 'PublicEmailBody',
24 changes: 24 additions & 0 deletions moz-extensions/src/differential/view/DifferentialReviewHelper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.

class DifferentialReviewHelper extends Phobject {
private $content = array();

public function createJWT($viewer, $revision) {
$this->content[] = $this->createContent($viewer, $revision);
return $this->content;
}

public function createContent($viewer, $revision) {
$content = new PHUIInfoView();
$content->setTitle(pht('This is test.'));
$content->appendChild(hsprintf(pht("Hello world!")));
return $content->render();
#$warning->setSeverity(PHUIInfoView::SEVERITY_WARNING);
}
}
Original file line number Diff line number Diff line change
@@ -183,6 +183,9 @@ public function handleRequest(AphrontRequest $request) {
$moz_warnings = new DifferentialRevisionWarning();
$moz_warnings = $moz_warnings->createWarnings($viewer, $revision);

$review_helper = new DifferentialReviewHelper();
$review_helper = $review_helper->createJWT($viewer, $revision);

$large = $request->getStr('large');

$large_warning =
@@ -640,6 +643,7 @@ public function handleRequest(AphrontRequest $request) {
array(
$operations_box,
$moz_warnings,
$review_helper,
$info_view,
$details,
$diff_detail_box,