Page MenuHomePhabricator

D14457.id.diff
No OneTemporary

D14457.id.diff

diff --git a/src/applications/phame/controller/post/PhamePostViewController.php b/src/applications/phame/controller/post/PhamePostViewController.php
--- a/src/applications/phame/controller/post/PhamePostViewController.php
+++ b/src/applications/phame/controller/post/PhamePostViewController.php
@@ -17,9 +17,15 @@
$blog = $post->getBlog();
$crumbs = $this->buildApplicationCrumbs();
- $crumbs->addTextCrumb(
- $blog->getName(),
- $this->getApplicationURI('blog/view/'.$blog->getID().'/'));
+ if ($blog) {
+ $crumbs->addTextCrumb(
+ $blog->getName(),
+ $this->getApplicationURI('blog/view/'.$blog->getID().'/'));
+ } else {
+ $crumbs->addTextCrumb(
+ pht('[No Blog]'),
+ null);
+ }
$crumbs->addTextCrumb(
$post->getTitle(),
$this->getApplicationURI('post/view/'.$post->getID().'/'));
diff --git a/src/applications/phame/query/PhamePostSearchEngine.php b/src/applications/phame/query/PhamePostSearchEngine.php
--- a/src/applications/phame/query/PhamePostSearchEngine.php
+++ b/src/applications/phame/query/PhamePostSearchEngine.php
@@ -81,15 +81,20 @@
foreach ($posts as $post) {
$id = $post->getID();
- $blog = $viewer->renderHandle($post->getBlogPHID())->render();
+ $blog = $post->getBlog();
+ if ($blog) {
+ $blog_name = $viewer->renderHandle($post->getBlogPHID())->render();
+ $blog_name = pht('Blog: %s', $blog_name);
+ } else {
+ $blog_name = pht('[No Blog]');
+ }
$item = id(new PHUIObjectItemView())
->setUser($viewer)
->setObject($post)
->setHeader($post->getTitle())
->setStatusIcon('fa-star')
->setHref($this->getApplicationURI("/post/view/{$id}/"))
- ->addAttribute(
- pht('Blog: %s', $blog));
+ ->addAttribute($blog_name);
if ($post->isDraft()) {
$item->setStatusIcon('fa-star-o grey');
$item->setDisabled(true);
diff --git a/src/applications/phame/storage/PhamePost.php b/src/applications/phame/storage/PhamePost.php
--- a/src/applications/phame/storage/PhamePost.php
+++ b/src/applications/phame/storage/PhamePost.php
@@ -169,6 +169,8 @@
return $this->getBlog()->getViewPolicy();
} else if ($this->getBlog()) {
return $this->getBlog()->getEditPolicy();
+ } else {
+ return PhabricatorPolicies::POLICY_NOONE;
}
break;
case PhabricatorPolicyCapability::CAN_EDIT:

File Metadata

Mime Type
text/plain
Expires
Thu, May 9, 11:13 PM (3 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6280083
Default Alt Text
D14457.id.diff (2 KB)

Event Timeline