@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.

Add Subscribers to Phame Blogs / Posts

Summary: Fixes T9051, adds ability to edit blogs and posts and manually add subscribers. Also fixed bug granting tokens to posts.

Test Plan: Create a new blog, subcribe chad and notchad. Write a post, both are notified. Award token for hard work.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T9051

Differential Revision: https://secure.phabricator.com/D14432

+53 -26
+27 -13
src/applications/phame/controller/blog/PhameBlogEditController.php
··· 28 28 $blog->getPHID(), 29 29 PhabricatorProjectObjectHasProjectEdgeType::EDGECONST); 30 30 $v_projects = array_reverse($v_projects); 31 + $v_cc = PhabricatorSubscribersQuery::loadSubscribersForPHID( 32 + $blog->getPHID()); 31 33 32 34 } else { 33 35 $this->requireApplicationCapability( ··· 39 41 $page_title = pht('Create Blog'); 40 42 $cancel_uri = $this->getApplicationURI(); 41 43 $v_projects = array(); 44 + $v_cc = array(); 42 45 } 43 - $name = $blog->getName(); 44 - $description = $blog->getDescription(); 46 + $name = $blog->getName(); 47 + $description = $blog->getDescription(); 45 48 $custom_domain = $blog->getDomain(); 46 - $skin = $blog->getSkin(); 47 - $can_view = $blog->getViewPolicy(); 48 - $can_edit = $blog->getEditPolicy(); 49 - $can_join = $blog->getJoinPolicy(); 49 + $skin = $blog->getSkin(); 50 + $can_view = $blog->getViewPolicy(); 51 + $can_edit = $blog->getEditPolicy(); 52 + $can_join = $blog->getJoinPolicy(); 50 53 51 54 $e_name = true; 52 55 $e_custom_domain = null; 53 56 $e_view_policy = null; 54 57 $validation_exception = null; 55 58 if ($request->isFormPost()) { 56 - $name = $request->getStr('name'); 57 - $description = $request->getStr('description'); 59 + $name = $request->getStr('name'); 60 + $description = $request->getStr('description'); 58 61 $custom_domain = nonempty($request->getStr('custom_domain'), null); 59 - $skin = $request->getStr('skin'); 60 - $can_view = $request->getStr('can_view'); 61 - $can_edit = $request->getStr('can_edit'); 62 - $can_join = $request->getStr('can_join'); 63 - $v_projects = $request->getArr('projects'); 62 + $skin = $request->getStr('skin'); 63 + $can_view = $request->getStr('can_view'); 64 + $can_edit = $request->getStr('can_edit'); 65 + $can_join = $request->getStr('can_join'); 66 + $v_projects = $request->getArr('projects'); 67 + $v_cc = $request->getArr('cc'); 64 68 65 69 $xactions = array( 66 70 id(new PhameBlogTransaction()) ··· 84 88 id(new PhameBlogTransaction()) 85 89 ->setTransactionType(PhabricatorTransactions::TYPE_JOIN_POLICY) 86 90 ->setNewValue($can_join), 91 + id(new PhameBlogTransaction()) 92 + ->setTransactionType(PhabricatorTransactions::TYPE_SUBSCRIBERS) 93 + ->setNewValue(array('=' => $v_cc)), 87 94 ); 88 95 89 96 $proj_edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST; ··· 139 146 ->setID('blog-description') 140 147 ->setUser($viewer) 141 148 ->setDisableMacros(true)) 149 + ->appendControl( 150 + id(new AphrontFormTokenizerControl()) 151 + ->setLabel(pht('Subscribers')) 152 + ->setName('cc') 153 + ->setValue($v_cc) 154 + ->setUser($viewer) 155 + ->setDatasource(new PhabricatorMetaMTAMailableDatasource())) 142 156 ->appendChild( 143 157 id(new AphrontFormPolicyControl()) 144 158 ->setUser($viewer)
+15
src/applications/phame/controller/post/PhamePostEditController.php
··· 27 27 $post->getPHID(), 28 28 PhabricatorProjectObjectHasProjectEdgeType::EDGECONST); 29 29 $v_projects = array_reverse($v_projects); 30 + $v_cc = PhabricatorSubscribersQuery::loadSubscribersForPHID( 31 + $post->getPHID()); 30 32 } else { 31 33 $blog = id(new PhameBlogQuery()) 32 34 ->setViewer($viewer) ··· 41 43 return new Aphront404Response(); 42 44 } 43 45 $v_projects = array(); 46 + $v_cc = array(); 44 47 45 48 $post = PhamePost::initializePost($viewer, $blog); 46 49 $cancel_uri = $this->getApplicationURI('/blog/view/'.$blog->getID().'/'); ··· 65 68 $body = $request->getStr('body'); 66 69 $comments_widget = $request->getStr('comments_widget'); 67 70 $v_projects = $request->getArr('projects'); 71 + $v_cc = $request->getArr('cc'); 68 72 $visibility = $request->getInt('visibility'); 69 73 70 74 $xactions = array( ··· 83 87 id(new PhamePostTransaction()) 84 88 ->setTransactionType(PhamePostTransaction::TYPE_COMMENTS_WIDGET) 85 89 ->setNewValue($comments_widget), 90 + id(new PhamePostTransaction()) 91 + ->setTransactionType(PhabricatorTransactions::TYPE_SUBSCRIBERS) 92 + ->setNewValue(array('=' => $v_cc)), 93 + 86 94 ); 87 95 88 96 $proj_edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST; ··· 154 162 ->setID('post-body') 155 163 ->setUser($viewer) 156 164 ->setDisableMacros(true)) 165 + ->appendControl( 166 + id(new AphrontFormTokenizerControl()) 167 + ->setLabel(pht('Subscribers')) 168 + ->setName('cc') 169 + ->setValue($v_cc) 170 + ->setUser($viewer) 171 + ->setDatasource(new PhabricatorMetaMTAMailableDatasource())) 157 172 ->appendControl( 158 173 id(new AphrontFormTokenizerControl()) 159 174 ->setLabel(pht('Projects'))
-6
src/applications/phame/controller/post/PhamePostPublishController.php
··· 23 23 if ($request->isFormPost()) { 24 24 $xactions = array(); 25 25 $xactions[] = id(new PhamePostTransaction()) 26 - ->setTransactionType(PhamePostTransaction::TYPE_TITLE) 27 - ->setNewValue($post->getTitle()); 28 - $xactions[] = id(new PhamePostTransaction()) 29 - ->setTransactionType(PhamePostTransaction::TYPE_PHAME_TITLE) 30 - ->setNewValue($post->getPhameTitle()); 31 - $xactions[] = id(new PhamePostTransaction()) 32 26 ->setTransactionType(PhamePostTransaction::TYPE_VISIBILITY) 33 27 ->setNewValue(PhameConstants::VISIBILITY_PUBLISHED); 34 28
-6
src/applications/phame/controller/post/PhamePostUnpublishController.php
··· 21 21 if ($request->isFormPost()) { 22 22 $xactions = array(); 23 23 $xactions[] = id(new PhamePostTransaction()) 24 - ->setTransactionType(PhamePostTransaction::TYPE_TITLE) 25 - ->setNewValue($post->getTitle()); 26 - $xactions[] = id(new PhamePostTransaction()) 27 - ->setTransactionType(PhamePostTransaction::TYPE_PHAME_TITLE) 28 - ->setNewValue($post->getPhameTitle()); 29 - $xactions[] = id(new PhamePostTransaction()) 30 24 ->setTransactionType(PhamePostTransaction::TYPE_VISIBILITY) 31 25 ->setNewValue(PhameConstants::VISIBILITY_DRAFT); 32 26
+4
src/applications/phame/editor/PhameBlogEditor.php
··· 94 94 95 95 $errors = parent::validateTransaction($object, $type, $xactions); 96 96 97 + 97 98 switch ($type) { 98 99 case PhameBlogTransaction::TYPE_NAME: 99 100 $missing = $this->validateIsEmptyTextField( ··· 112 113 } 113 114 break; 114 115 case PhameBlogTransaction::TYPE_DOMAIN: 116 + if (!$xactions) { 117 + continue; 118 + } 115 119 $custom_domain = last($xactions)->getNewValue(); 116 120 if (empty($custom_domain)) { 117 121 continue;
+7 -1
src/applications/phame/editor/PhamePostEditor.php
··· 121 121 } 122 122 break; 123 123 case PhamePostTransaction::TYPE_PHAME_TITLE: 124 + if (!$xactions) { 125 + continue; 126 + } 124 127 $missing = $this->validateIsEmptyTextField( 125 128 $object->getPhameTitle(), 126 129 $xactions); ··· 183 186 184 187 $blog_phid = $object->getBlogPHID(); 185 188 if ($blog_phid) { 186 - $phids[] = PhabricatorSubscribersQuery::loadSubscribersForPHID( 189 + $cc_phids = PhabricatorSubscribersQuery::loadSubscribersForPHID( 187 190 $blog_phid); 191 + foreach ($cc_phids as $cc) { 192 + $phids[] = $cc; 193 + } 188 194 } 189 195 return $phids; 190 196 }