Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14878171
D13677.id33061.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D13677.id33061.diff
View Options
diff --git a/src/applications/phame/controller/post/PhamePostFramedController.php b/src/applications/phame/controller/post/PhamePostFramedController.php
--- a/src/applications/phame/controller/post/PhamePostFramedController.php
+++ b/src/applications/phame/controller/post/PhamePostFramedController.php
@@ -2,19 +2,13 @@
final class PhamePostFramedController extends PhameController {
- private $id;
-
- public function willProcessRequest(array $data) {
- $this->id = $data['id'];
- }
-
- public function processRequest() {
- $request = $this->getRequest();
- $user = $request->getUser();
+ public function handleRequest(AphrontRequest $request) {
+ $user = $request->getViewer();
+ $id = $request->getURIData('id');
$post = id(new PhamePostQuery())
->setViewer($user)
- ->withIDs(array($this->id))
+ ->withIDs(array($id))
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_EDIT,
diff --git a/src/applications/phame/controller/post/PhamePostListController.php b/src/applications/phame/controller/post/PhamePostListController.php
--- a/src/applications/phame/controller/post/PhamePostListController.php
+++ b/src/applications/phame/controller/post/PhamePostListController.php
@@ -2,46 +2,45 @@
final class PhamePostListController extends PhameController {
- private $bloggername;
- private $filter;
-
- public function willProcessRequest(array $data) {
- $this->filter = idx($data, 'filter', 'blogger');
- $this->bloggername = idx($data, 'bloggername');
- }
-
- public function processRequest() {
- $request = $this->getRequest();
- $user = $request->getUser();
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $request->getViewer();
+ $filter = $request->getURIData('filter');
+ $bloggername = $request->getURIData('bloggername');
$query = id(new PhamePostQuery())
- ->setViewer($user);
+ ->setViewer($viewer);
$nav = $this->renderSideNavFilterView();
$nodata = null;
- switch ($this->filter) {
+ switch ($filter) {
case 'draft':
- $query->withBloggerPHIDs(array($user->getPHID()));
+ $query->withBloggerPHIDs(array($viewer->getPHID()));
$query->withVisibility(PhamePost::VISIBILITY_DRAFT);
$nodata = pht('You have no unpublished drafts.');
$title = pht('Unpublished Drafts');
$nav->selectFilter('post/draft');
break;
+ case 'all':
+ $nodata = pht('There are no visible posts.');
+ $title = pht('Posts');
+ $nav->selectFilter('post/all');
+ break;
+ default:
case 'blogger':
- if ($this->bloggername) {
+ if ($bloggername) {
$blogger = id(new PhabricatorUser())->loadOneWhere(
'username = %s',
- $this->bloggername);
+ $bloggername);
if (!$blogger) {
return new Aphront404Response();
}
} else {
- $blogger = $user;
+ $blogger = $viewer;
}
$query->withBloggerPHIDs(array($blogger->getPHID()));
- if ($blogger->getPHID() == $user->getPHID()) {
+ if ($blogger->getPHID() == $viewer->getPHID()) {
$nav->selectFilter('post');
$nodata = pht('You have not written any posts.');
} else {
@@ -49,13 +48,6 @@
}
$title = pht('Posts by %s', $blogger);
break;
- case 'all':
- $nodata = pht('There are no visible posts.');
- $title = pht('Posts');
- $nav->selectFilter('post/all');
- break;
- default:
- throw new Exception(pht("Unknown filter '%s'!", $this->filter));
}
$pager = id(new AphrontCursorPagerView())
@@ -64,7 +56,7 @@
$posts = $query->executeWithCursorPager($pager);
require_celerity_resource('phame-css');
- $post_list = $this->renderPostList($posts, $user, $nodata);
+ $post_list = $this->renderPostList($posts, $viewer, $nodata);
$post_list = id(new PHUIObjectBoxView())
->setHeaderText($title)
->appendChild($post_list);
diff --git a/src/applications/phame/controller/post/PhamePostNotLiveController.php b/src/applications/phame/controller/post/PhamePostNotLiveController.php
--- a/src/applications/phame/controller/post/PhamePostNotLiveController.php
+++ b/src/applications/phame/controller/post/PhamePostNotLiveController.php
@@ -2,19 +2,13 @@
final class PhamePostNotLiveController extends PhameController {
- private $id;
-
- public function willProcessRequest(array $data) {
- $this->id = $data['id'];
- }
-
- public function processRequest() {
- $request = $this->getRequest();
+ public function handleRequest(AphrontRequest $request) {
$user = $request->getUser();
+ $id = $request->getURIData('id');
$post = id(new PhamePostQuery())
->setViewer($user)
- ->withIDs(array($this->id))
+ ->withIDs(array($id))
->executeOne();
if (!$post) {
return new Aphront404Response();
diff --git a/src/applications/phame/controller/post/PhamePostPublishController.php b/src/applications/phame/controller/post/PhamePostPublishController.php
--- a/src/applications/phame/controller/post/PhamePostPublishController.php
+++ b/src/applications/phame/controller/post/PhamePostPublishController.php
@@ -2,19 +2,13 @@
final class PhamePostPublishController extends PhameController {
- private $id;
-
- public function willProcessRequest(array $data) {
- $this->id = $data['id'];
- }
-
- public function processRequest() {
- $request = $this->getRequest();
+ public function handleRequest(AphrontRequest $request) {
$user = $request->getUser();
+ $id = $request->getURIData('id');
$post = id(new PhamePostQuery())
->setViewer($user)
- ->withIDs(array($this->id))
+ ->withIDs(array($id))
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_EDIT,
diff --git a/src/applications/phame/controller/post/PhamePostUnpublishController.php b/src/applications/phame/controller/post/PhamePostUnpublishController.php
--- a/src/applications/phame/controller/post/PhamePostUnpublishController.php
+++ b/src/applications/phame/controller/post/PhamePostUnpublishController.php
@@ -2,19 +2,13 @@
final class PhamePostUnpublishController extends PhameController {
- private $id;
-
- public function willProcessRequest(array $data) {
- $this->id = $data['id'];
- }
-
- public function processRequest() {
- $request = $this->getRequest();
+ public function handleRequest(AphrontRequest $request) {
$user = $request->getUser();
+ $id = $request->getURIData('id');
$post = id(new PhamePostQuery())
->setViewer($user)
- ->withIDs(array($this->id))
+ ->withIDs(array($id))
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_EDIT,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Feb 9, 9:41 PM (16 h, 19 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7109088
Default Alt Text
D13677.id33061.diff (6 KB)
Attached To
Mode
D13677: Modernize Phame process handlers
Attached
Detach File
Event Timeline
Log In to Comment