@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at recaptime-dev/main 68 lines 1.9 kB view raw
1<?php 2 3final class PhameBlogArchiveController 4 extends PhameBlogController { 5 6 public function handleRequest(AphrontRequest $request) { 7 $viewer = $request->getViewer(); 8 $id = $request->getURIData('id'); 9 10 $blog = id(new PhameBlogQuery()) 11 ->setViewer($viewer) 12 ->withIDs(array($id)) 13 ->requireCapabilities( 14 array( 15 PhabricatorPolicyCapability::CAN_VIEW, 16 PhabricatorPolicyCapability::CAN_EDIT, 17 )) 18 ->executeOne(); 19 if (!$blog) { 20 return new Aphront404Response(); 21 } 22 23 $view_uri = $this->getApplicationURI('blog/manage/'.$blog->getID().'/'); 24 25 if ($request->isFormPost()) { 26 if ($blog->isArchived()) { 27 $new_status = PhameBlog::STATUS_ACTIVE; 28 } else { 29 $new_status = PhameBlog::STATUS_ARCHIVED; 30 } 31 32 $xactions = array(); 33 34 $xactions[] = id(new PhameBlogTransaction()) 35 ->setTransactionType(PhameBlogStatusTransaction::TRANSACTIONTYPE) 36 ->setNewValue($new_status); 37 38 id(new PhameBlogEditor()) 39 ->setActor($viewer) 40 ->setContentSourceFromRequest($request) 41 ->setContinueOnNoEffect(true) 42 ->setContinueOnMissingFields(true) 43 ->applyTransactions($blog, $xactions); 44 45 return id(new AphrontRedirectResponse())->setURI($view_uri); 46 } 47 48 if ($blog->isArchived()) { 49 $title = pht('Activate Blog'); 50 $body = pht('This blog will become active again.'); 51 $button = pht('Activate Blog'); 52 } else { 53 $title = pht('Archive Blog'); 54 $body = pht('This blog will be marked as archived.'); 55 $button = pht('Archive Blog'); 56 } 57 58 $dialog = id(new AphrontDialogView()) 59 ->setUser($viewer) 60 ->setTitle($title) 61 ->appendChild($body) 62 ->addCancelButton($view_uri) 63 ->addSubmitButton($button); 64 65 return id(new AphrontDialogResponse())->setDialog($dialog); 66 } 67 68}