Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14055030
D16010.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
7 KB
Referenced Files
None
Subscribers
None
D16010.diff
View Options
diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -81,7 +81,7 @@
'rsrc/css/application/owners/owners-path-editor.css' => '2f00933b',
'rsrc/css/application/paste/paste.css' => '1898e534',
'rsrc/css/application/people/people-profile.css' => '2473d929',
- 'rsrc/css/application/phame/phame.css' => '737792d6',
+ 'rsrc/css/application/phame/phame.css' => '7448a969',
'rsrc/css/application/pholio/pholio-edit.css' => 'b15fec4a',
'rsrc/css/application/pholio/pholio-inline-comments.css' => '8e545e49',
'rsrc/css/application/pholio/pholio.css' => 'ca89d380',
@@ -806,7 +806,7 @@
'phabricator-uiexample-reactor-sendclass' => '1def2711',
'phabricator-uiexample-reactor-sendproperties' => 'b1f0ccee',
'phabricator-zindex-css' => '5b6fcf3f',
- 'phame-css' => '737792d6',
+ 'phame-css' => '7448a969',
'pholio-css' => 'ca89d380',
'pholio-edit-css' => 'b15fec4a',
'pholio-inline-comments-css' => '8e545e49',
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -3708,7 +3708,9 @@
'PhabricatorXHProfSample' => 'applications/xhprof/storage/PhabricatorXHProfSample.php',
'PhabricatorXHProfSampleListController' => 'applications/xhprof/controller/PhabricatorXHProfSampleListController.php',
'PhabricatorYoutubeRemarkupRule' => 'infrastructure/markup/rule/PhabricatorYoutubeRemarkupRule.php',
+ 'Phame404Response' => 'applications/phame/site/Phame404Response.php',
'PhameBlog' => 'applications/phame/storage/PhameBlog.php',
+ 'PhameBlog404Controller' => 'applications/phame/controller/blog/PhameBlog404Controller.php',
'PhameBlogArchiveController' => 'applications/phame/controller/blog/PhameBlogArchiveController.php',
'PhameBlogController' => 'applications/phame/controller/blog/PhameBlogController.php',
'PhameBlogCreateCapability' => 'applications/phame/capability/PhameBlogCreateCapability.php',
@@ -8508,6 +8510,7 @@
'PhabricatorXHProfSample' => 'PhabricatorXHProfDAO',
'PhabricatorXHProfSampleListController' => 'PhabricatorXHProfController',
'PhabricatorYoutubeRemarkupRule' => 'PhutilRemarkupRule',
+ 'Phame404Response' => 'AphrontHTMLResponse',
'PhameBlog' => array(
'PhameDAO',
'PhabricatorPolicyInterface',
@@ -8519,6 +8522,7 @@
'PhabricatorApplicationTransactionInterface',
'PhabricatorConduitResultInterface',
),
+ 'PhameBlog404Controller' => 'PhameLiveController',
'PhameBlogArchiveController' => 'PhameBlogController',
'PhameBlogController' => 'PhameController',
'PhameBlogCreateCapability' => 'PhabricatorPolicyCapability',
diff --git a/src/applications/phame/application/PhabricatorPhameApplication.php b/src/applications/phame/application/PhabricatorPhameApplication.php
--- a/src/applications/phame/application/PhabricatorPhameApplication.php
+++ b/src/applications/phame/application/PhabricatorPhameApplication.php
@@ -93,7 +93,9 @@
'/' => array(
'' => 'PhameBlogViewController',
'post/(?P<id>\d+)/(?:(?P<slug>[^/]+)/)?' => 'PhamePostViewController',
+ '.*' => 'PhameBlog404Controller',
),
+
);
}
diff --git a/src/applications/phame/controller/PhameLiveController.php b/src/applications/phame/controller/PhameLiveController.php
--- a/src/applications/phame/controller/PhameLiveController.php
+++ b/src/applications/phame/controller/PhameLiveController.php
@@ -70,6 +70,8 @@
$blog = $blog_query->executeOne();
if (!$blog) {
+ $this->isExternal = $is_external;
+ $this->isLive = $is_live;
return new Aphront404Response();
}
@@ -81,6 +83,9 @@
$blog = null;
}
+ $this->isExternal = $is_external;
+ $this->isLive = $is_live;
+
if ($post_id) {
$post_query = id(new PhamePostQuery())
->setViewer($viewer)
@@ -109,8 +114,6 @@
$post = null;
}
- $this->isExternal = $is_external;
- $this->isLive = $is_live;
$this->blog = $blog;
$this->post = $post;
@@ -188,4 +191,30 @@
return $crumbs;
}
+ public function willSendResponse(AphrontResponse $response) {
+ if ($this->getIsExternal()) {
+ if ($response instanceof Aphront404Response) {
+ $page = $this->newPage()
+ ->setCrumbs($this->buildApplicationCrumbs());
+
+ $response = id(new Phame404Response())
+ ->setPage($page);
+ }
+ }
+
+ return parent::willSendResponse($response);
+ }
+
+ public function newPage() {
+ $page = parent::newPage();
+
+ if ($this->getIsLive()) {
+ $page
+ ->setShowChrome(false)
+ ->setShowFooter(false);
+ }
+
+ return $page;
+ }
+
}
diff --git a/src/applications/phame/controller/blog/PhameBlog404Controller.php b/src/applications/phame/controller/blog/PhameBlog404Controller.php
new file mode 100644
--- /dev/null
+++ b/src/applications/phame/controller/blog/PhameBlog404Controller.php
@@ -0,0 +1,14 @@
+<?php
+
+final class PhameBlog404Controller extends PhameLiveController {
+
+ public function handleRequest(AphrontRequest $request) {
+ $response = $this->setupLiveEnvironment();
+ if ($response) {
+ return $response;
+ }
+
+ return new Aphront404Response();
+ }
+
+}
diff --git a/src/applications/phame/controller/blog/PhameBlogViewController.php b/src/applications/phame/controller/blog/PhameBlogViewController.php
--- a/src/applications/phame/controller/blog/PhameBlogViewController.php
+++ b/src/applications/phame/controller/blog/PhameBlogViewController.php
@@ -108,12 +108,6 @@
$about,
));
- if ($is_live) {
- $page
- ->setShowChrome(false)
- ->setShowFooter(false);
- }
-
return $page;
}
diff --git a/src/applications/phame/site/Phame404Response.php b/src/applications/phame/site/Phame404Response.php
new file mode 100644
--- /dev/null
+++ b/src/applications/phame/site/Phame404Response.php
@@ -0,0 +1,43 @@
+<?php
+
+final class Phame404Response extends AphrontHTMLResponse {
+
+ private $page;
+
+ public function setPage(AphrontPageView $page) {
+ $this->page = $page;
+ return $this;
+ }
+
+ public function getPage() {
+ return $this->page;
+ }
+
+ public function getHTTPResponseCode() {
+ return 404;
+ }
+
+ public function buildResponseString() {
+ require_celerity_resource('phame-css');
+
+ $not_found = phutil_tag(
+ 'div',
+ array(
+ 'class' => 'phame-404',
+ ),
+ array(
+ phutil_tag('strong', array(), pht('404 Not Found')),
+ phutil_tag('br'),
+ pht('Wherever you go, there you are.'),
+ phutil_tag('br'),
+ pht('But the page you seek is elsewhere.'),
+ ));
+
+ $page = $this->getPage()
+ ->setTitle(pht('404 Not Found'))
+ ->appendChild($not_found);
+
+ return $page->render();
+ }
+
+}
diff --git a/webroot/rsrc/css/application/phame/phame.css b/webroot/rsrc/css/application/phame/phame.css
--- a/webroot/rsrc/css/application/phame/phame.css
+++ b/webroot/rsrc/css/application/phame/phame.css
@@ -243,3 +243,13 @@
left: 50px;
position: absolute;
}
+
+.phame-404 {
+ margin: 48px auto;
+ padding: 12px 24px;
+ border-radius: 6px;
+ min-width: 240px;
+ width: 50%;
+ color: {$darkgreytext};
+ background: {$greybackground};
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 17, 7:35 AM (1 d, 13 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6742548
Default Alt Text
D16010.diff (7 KB)
Attached To
Mode
D16010: Give Phame blogs an explicit 404 controller
Attached
Detach File
Event Timeline
Log In to Comment