1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

Make deleting a blog a little easier to recover from

Summary: We currently orphan posts when you delete a blog. Fixes some visibility and permission errors when that happens. Also... should allow you to archive posts.

Test Plan: Delete a blog, visit a post I made, still can see it.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T9360

Differential Revision: https://secure.phabricator.com/D14457
This commit is contained in:
Chad Little 2015-11-10 11:50:19 -08:00
parent 0398097498
commit 1365b37fae
3 changed files with 19 additions and 6 deletions

View file

@ -17,9 +17,15 @@ final class PhamePostViewController extends PhamePostController {
$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().'/'));

View file

@ -81,15 +81,20 @@ final class PhamePostSearchEngine
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);

View file

@ -169,6 +169,8 @@ final class PhamePost extends PhameDAO
return $this->getBlog()->getViewPolicy();
} else if ($this->getBlog()) {
return $this->getBlog()->getEditPolicy();
} else {
return PhabricatorPolicies::POLICY_NOONE;
}
break;
case PhabricatorPolicyCapability::CAN_EDIT: