mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 13:30:55 +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:
parent
0398097498
commit
1365b37fae
3 changed files with 19 additions and 6 deletions
|
@ -17,9 +17,15 @@ final class PhamePostViewController extends PhamePostController {
|
||||||
$blog = $post->getBlog();
|
$blog = $post->getBlog();
|
||||||
|
|
||||||
$crumbs = $this->buildApplicationCrumbs();
|
$crumbs = $this->buildApplicationCrumbs();
|
||||||
$crumbs->addTextCrumb(
|
if ($blog) {
|
||||||
$blog->getName(),
|
$crumbs->addTextCrumb(
|
||||||
$this->getApplicationURI('blog/view/'.$blog->getID().'/'));
|
$blog->getName(),
|
||||||
|
$this->getApplicationURI('blog/view/'.$blog->getID().'/'));
|
||||||
|
} else {
|
||||||
|
$crumbs->addTextCrumb(
|
||||||
|
pht('[No Blog]'),
|
||||||
|
null);
|
||||||
|
}
|
||||||
$crumbs->addTextCrumb(
|
$crumbs->addTextCrumb(
|
||||||
$post->getTitle(),
|
$post->getTitle(),
|
||||||
$this->getApplicationURI('post/view/'.$post->getID().'/'));
|
$this->getApplicationURI('post/view/'.$post->getID().'/'));
|
||||||
|
|
|
@ -81,15 +81,20 @@ final class PhamePostSearchEngine
|
||||||
|
|
||||||
foreach ($posts as $post) {
|
foreach ($posts as $post) {
|
||||||
$id = $post->getID();
|
$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())
|
$item = id(new PHUIObjectItemView())
|
||||||
->setUser($viewer)
|
->setUser($viewer)
|
||||||
->setObject($post)
|
->setObject($post)
|
||||||
->setHeader($post->getTitle())
|
->setHeader($post->getTitle())
|
||||||
->setStatusIcon('fa-star')
|
->setStatusIcon('fa-star')
|
||||||
->setHref($this->getApplicationURI("/post/view/{$id}/"))
|
->setHref($this->getApplicationURI("/post/view/{$id}/"))
|
||||||
->addAttribute(
|
->addAttribute($blog_name);
|
||||||
pht('Blog: %s', $blog));
|
|
||||||
if ($post->isDraft()) {
|
if ($post->isDraft()) {
|
||||||
$item->setStatusIcon('fa-star-o grey');
|
$item->setStatusIcon('fa-star-o grey');
|
||||||
$item->setDisabled(true);
|
$item->setDisabled(true);
|
||||||
|
|
|
@ -169,6 +169,8 @@ final class PhamePost extends PhameDAO
|
||||||
return $this->getBlog()->getViewPolicy();
|
return $this->getBlog()->getViewPolicy();
|
||||||
} else if ($this->getBlog()) {
|
} else if ($this->getBlog()) {
|
||||||
return $this->getBlog()->getEditPolicy();
|
return $this->getBlog()->getEditPolicy();
|
||||||
|
} else {
|
||||||
|
return PhabricatorPolicies::POLICY_NOONE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PhabricatorPolicyCapability::CAN_EDIT:
|
case PhabricatorPolicyCapability::CAN_EDIT:
|
||||||
|
|
Loading…
Reference in a new issue