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

Remove comment plugins from Phame

Summary: Cleaning up house, may revisit in a v2. Removes ability to set Disqus or Facebook comments as comment system on Phame Posts.

Test Plan: Create blog, create post, edit blog, view live pages.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: btrahan, Korvin

Maniphest Tasks: T9746

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

-212
-2
src/__phutil_library_map__.php
··· 2095 2095 'PhabricatorDisabledUserController' => 'applications/auth/controller/PhabricatorDisabledUserController.php', 2096 2096 'PhabricatorDisplayPreferencesSettingsPanel' => 'applications/settings/panel/PhabricatorDisplayPreferencesSettingsPanel.php', 2097 2097 'PhabricatorDisqusAuthProvider' => 'applications/auth/provider/PhabricatorDisqusAuthProvider.php', 2098 - 'PhabricatorDisqusConfigOptions' => 'applications/config/option/PhabricatorDisqusConfigOptions.php', 2099 2098 'PhabricatorDivinerApplication' => 'applications/diviner/application/PhabricatorDivinerApplication.php', 2100 2099 'PhabricatorDoorkeeperApplication' => 'applications/doorkeeper/application/PhabricatorDoorkeeperApplication.php', 2101 2100 'PhabricatorDraft' => 'applications/draft/storage/PhabricatorDraft.php', ··· 6155 6154 'PhabricatorDisabledUserController' => 'PhabricatorAuthController', 6156 6155 'PhabricatorDisplayPreferencesSettingsPanel' => 'PhabricatorSettingsPanel', 6157 6156 'PhabricatorDisqusAuthProvider' => 'PhabricatorOAuth2AuthProvider', 6158 - 'PhabricatorDisqusConfigOptions' => 'PhabricatorApplicationConfigOptions', 6159 6157 'PhabricatorDivinerApplication' => 'PhabricatorApplication', 6160 6158 'PhabricatorDoorkeeperApplication' => 'PhabricatorApplication', 6161 6159 'PhabricatorDraft' => 'PhabricatorDraftDAO',
-35
src/applications/config/option/PhabricatorDisqusConfigOptions.php
··· 1 - <?php 2 - 3 - final class PhabricatorDisqusConfigOptions 4 - extends PhabricatorApplicationConfigOptions { 5 - 6 - public function getName() { 7 - return pht('Integration with Disqus'); 8 - } 9 - 10 - public function getDescription() { 11 - return pht('Disqus authentication and integration options.'); 12 - } 13 - 14 - public function getFontIcon() { 15 - return 'fa-comment'; 16 - } 17 - 18 - public function getGroup() { 19 - return 'core'; 20 - } 21 - 22 - public function getOptions() { 23 - return array( 24 - $this->newOption('disqus.shortname', 'string', null) 25 - ->setSummary(pht('Shortname for Disqus comment widget.')) 26 - ->setDescription( 27 - pht( 28 - "Website shortname to use for Disqus comment widget in Phame. ". 29 - "For more information, see:\n\n". 30 - "[[http://docs.disqus.com/help/4/ | Disqus Quick Start Guide]]\n". 31 - "[[http://docs.disqus.com/help/68/ | Information on Shortnames]]")), 32 - ); 33 - } 34 - 35 - }
-11
src/applications/phame/controller/post/PhamePostEditController.php
··· 55 55 $title = $post->getTitle(); 56 56 $phame_title = $post->getPhameTitle(); 57 57 $body = $post->getBody(); 58 - $comments_widget = $post->getCommentsWidget(); 59 58 $visibility = $post->getVisibility(); 60 59 61 60 $e_title = true; ··· 66 65 $phame_title = $request->getStr('phame_title'); 67 66 $phame_title = PhabricatorSlug::normalize($phame_title); 68 67 $body = $request->getStr('body'); 69 - $comments_widget = $request->getStr('comments_widget'); 70 68 $v_projects = $request->getArr('projects'); 71 69 $v_cc = $request->getArr('cc'); 72 70 $visibility = $request->getInt('visibility'); ··· 84 82 id(new PhamePostTransaction()) 85 83 ->setTransactionType(PhamePostTransaction::TYPE_VISIBILITY) 86 84 ->setNewValue($visibility), 87 - id(new PhamePostTransaction()) 88 - ->setTransactionType(PhamePostTransaction::TYPE_COMMENTS_WIDGET) 89 - ->setNewValue($comments_widget), 90 85 id(new PhamePostTransaction()) 91 86 ->setTransactionType(PhabricatorTransactions::TYPE_SUBSCRIBERS) 92 87 ->setNewValue(array('=' => $v_cc)), ··· 175 170 ->setName('projects') 176 171 ->setValue($v_projects) 177 172 ->setDatasource(new PhabricatorProjectDatasource())) 178 - ->appendChild( 179 - id(new AphrontFormSelectControl()) 180 - ->setLabel(pht('Comments Widget')) 181 - ->setName('comments_widget') 182 - ->setvalue($comments_widget) 183 - ->setOptions($post->getCommentsWidgetOptionsForSelect())) 184 173 ->appendChild( 185 174 id(new AphrontFormSubmitControl()) 186 175 ->addCancelButton($cancel_uri)
-7
src/applications/phame/editor/PhamePostEditor.php
··· 18 18 $types[] = PhamePostTransaction::TYPE_PHAME_TITLE; 19 19 $types[] = PhamePostTransaction::TYPE_BODY; 20 20 $types[] = PhamePostTransaction::TYPE_VISIBILITY; 21 - $types[] = PhamePostTransaction::TYPE_COMMENTS_WIDGET; 22 21 23 22 return $types; 24 23 } ··· 36 35 return $object->getBody(); 37 36 case PhamePostTransaction::TYPE_VISIBILITY: 38 37 return $object->getVisibility(); 39 - case PhamePostTransaction::TYPE_COMMENTS_WIDGET: 40 - return $object->getCommentsWidget(); 41 38 } 42 39 } 43 40 ··· 50 47 case PhamePostTransaction::TYPE_PHAME_TITLE: 51 48 case PhamePostTransaction::TYPE_BODY: 52 49 case PhamePostTransaction::TYPE_VISIBILITY: 53 - case PhamePostTransaction::TYPE_COMMENTS_WIDGET: 54 50 return $xaction->getNewValue(); 55 51 } 56 52 } ··· 73 69 $object->setDatePublished(0); 74 70 } 75 71 return $object->setVisibility($xaction->getNewValue()); 76 - case PhamePostTransaction::TYPE_COMMENTS_WIDGET: 77 - return $object->setCommentsWidget($xaction->getNewValue()); 78 72 } 79 73 80 74 return parent::applyCustomInternalTransaction($object, $xaction); ··· 89 83 case PhamePostTransaction::TYPE_PHAME_TITLE: 90 84 case PhamePostTransaction::TYPE_BODY: 91 85 case PhamePostTransaction::TYPE_VISIBILITY: 92 - case PhamePostTransaction::TYPE_COMMENTS_WIDGET: 93 86 return; 94 87 } 95 88
-31
src/applications/phame/storage/PhamePost.php
··· 76 76 return $name; 77 77 } 78 78 79 - public function setCommentsWidget($widget) { 80 - $config_data = $this->getConfigData(); 81 - $config_data['comments_widget'] = $widget; 82 - return $this; 83 - } 84 - 85 - public function getCommentsWidget() { 86 - $config_data = $this->getConfigData(); 87 - if (empty($config_data)) { 88 - return 'none'; 89 - } 90 - return idx($config_data, 'comments_widget', 'none'); 91 - } 92 - 93 79 protected function getConfiguration() { 94 80 return array( 95 81 self::CONFIG_AUX_PHID => true, ··· 160 146 'datePublished' => $this->getDatePublished(), 161 147 'published' => !$this->isDraft(), 162 148 ); 163 - } 164 - 165 - public function getCommentsWidgetOptionsForSelect() { 166 - $current = $this->getCommentsWidget(); 167 - $options = array(); 168 - 169 - if ($current == 'facebook' || 170 - PhabricatorFacebookAuthProvider::getFacebookApplicationID()) { 171 - $options['facebook'] = pht('Facebook'); 172 - } 173 - if ($current == 'disqus' || 174 - PhabricatorEnv::getEnvConfig('disqus.shortname')) { 175 - $options['disqus'] = pht('Disqus'); 176 - } 177 - $options['none'] = pht('None'); 178 - 179 - return $options; 180 149 } 181 150 182 151
-15
src/applications/phame/storage/PhamePostTransaction.php
··· 7 7 const TYPE_PHAME_TITLE = 'phame.post.phame.title'; 8 8 const TYPE_BODY = 'phame.post.body'; 9 9 const TYPE_VISIBILITY = 'phame.post.visibility'; 10 - const TYPE_COMMENTS_WIDGET = 'phame.post.comments.widget'; 11 10 12 11 const MAILTAG_CONTENT = 'phame-post-content'; 13 12 const MAILTAG_COMMENT = 'phame-post-comment'; ··· 56 55 case self::TYPE_PHAME_TITLE: 57 56 case self::TYPE_BODY: 58 57 case self::TYPE_VISIBILITY: 59 - case self::TYPE_COMMENTS_WIDGET: 60 58 return 'fa-pencil'; 61 59 break; 62 60 } ··· 67 65 $tags = parent::getMailTags(); 68 66 69 67 switch ($this->getTransactionType()) { 70 - case self::TYPE_COMMENTS_WIDGET: 71 68 case PhabricatorTransactions::TYPE_COMMENT: 72 69 $tags[] = self::MAILTAG_COMMENT; 73 70 break; ··· 127 124 $this->renderHandleLink($author_phid), 128 125 rtrim($new, '/')); 129 126 break; 130 - case self::TYPE_COMMENTS_WIDGET: 131 - return pht( 132 - '%s updated the post\'s comment widget to "%s".', 133 - $this->renderHandleLink($author_phid), 134 - $new); 135 - break; 136 127 } 137 128 138 129 return parent::getTitle(); ··· 182 173 case self::TYPE_PHAME_TITLE: 183 174 return pht( 184 175 '%s updated the Phame title for %s.', 185 - $this->renderHandleLink($author_phid), 186 - $this->renderHandleLink($object_phid)); 187 - break; 188 - case self::TYPE_COMMENTS_WIDGET: 189 - return pht( 190 - '%s updated the comments widget for %s.', 191 176 $this->renderHandleLink($author_phid), 192 177 $this->renderHandleLink($object_phid)); 193 178 break;
-111
src/applications/phame/view/PhamePostView.php
··· 101 101 $this->getSummary()); 102 102 } 103 103 104 - public function renderComments() { 105 - $post = $this->getPost(); 106 - 107 - switch ($post->getCommentsWidget()) { 108 - case 'facebook': 109 - $comments = $this->renderFacebookComments(); 110 - break; 111 - case 'disqus': 112 - $comments = $this->renderDisqusComments(); 113 - break; 114 - case 'none': 115 - default: 116 - $comments = null; 117 - break; 118 - } 119 - return $comments; 120 - } 121 - 122 104 public function render() { 123 105 return phutil_tag( 124 106 'div', ··· 129 111 $this->renderTitle(), 130 112 $this->renderDatePublished(), 131 113 $this->renderBody(), 132 - $this->renderComments(), 133 114 )); 134 115 } 135 116 ··· 143 124 $this->renderTitle(), 144 125 $this->renderDatePublished(), 145 126 $this->renderSummary(), 146 - )); 147 - } 148 - 149 - private function renderFacebookComments() { 150 - $fb_id = PhabricatorFacebookAuthProvider::getFacebookApplicationID(); 151 - if (!$fb_id) { 152 - return null; 153 - } 154 - 155 - $fb_root = phutil_tag('div', 156 - array( 157 - 'id' => 'fb-root', 158 - ), 159 - ''); 160 - 161 - $c_uri = '//connect.facebook.net/en_US/all.js#xfbml=1&appId='.$fb_id; 162 - $fb_js = CelerityStaticResourceResponse::renderInlineScript( 163 - jsprintf( 164 - '(function(d, s, id) {'. 165 - ' var js, fjs = d.getElementsByTagName(s)[0];'. 166 - ' if (d.getElementById(id)) return;'. 167 - ' js = d.createElement(s); js.id = id;'. 168 - ' js.src = %s;'. 169 - ' fjs.parentNode.insertBefore(js, fjs);'. 170 - '}(document, \'script\', \'facebook-jssdk\'));', 171 - $c_uri)); 172 - 173 - 174 - $uri = $this->getSkin()->getURI('post/'.$this->getPost()->getPhameTitle()); 175 - 176 - require_celerity_resource('phame-css'); 177 - $fb_comments = phutil_tag('div', 178 - array( 179 - 'class' => 'fb-comments', 180 - 'data-href' => $uri, 181 - 'data-num-posts' => 5, 182 - ), 183 - ''); 184 - 185 - return phutil_tag( 186 - 'div', 187 - array( 188 - 'class' => 'phame-comments-facebook', 189 - ), 190 - array( 191 - $fb_root, 192 - $fb_js, 193 - $fb_comments, 194 - )); 195 - } 196 - 197 - private function renderDisqusComments() { 198 - $disqus_shortname = PhabricatorEnv::getEnvConfig('disqus.shortname'); 199 - if (!$disqus_shortname) { 200 - return null; 201 - } 202 - 203 - $post = $this->getPost(); 204 - 205 - $disqus_thread = phutil_tag('div', 206 - array( 207 - 'id' => 'disqus_thread', 208 - )); 209 - 210 - // protip - try some var disqus_developer = 1; action to test locally 211 - $disqus_js = CelerityStaticResourceResponse::renderInlineScript( 212 - jsprintf( 213 - ' var disqus_shortname = %s;'. 214 - ' var disqus_identifier = %s;'. 215 - ' var disqus_url = %s;'. 216 - ' var disqus_title = %s;'. 217 - '(function() {'. 218 - ' var dsq = document.createElement("script");'. 219 - ' dsq.type = "text/javascript";'. 220 - ' dsq.async = true;'. 221 - ' dsq.src = "//" + disqus_shortname + ".disqus.com/embed.js";'. 222 - '(document.getElementsByTagName("head")[0] ||'. 223 - ' document.getElementsByTagName("body")[0]).appendChild(dsq);'. 224 - '})();', 225 - $disqus_shortname, 226 - $post->getPHID(), 227 - $this->getSkin()->getURI('post/'.$this->getPost()->getPhameTitle()), 228 - $post->getTitle())); 229 - 230 - return phutil_tag( 231 - 'div', 232 - array( 233 - 'class' => 'phame-comments-disqus', 234 - ), 235 - array( 236 - $disqus_thread, 237 - $disqus_js, 238 127 )); 239 128 } 240 129