diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -2095,7 +2095,6 @@ 'PhabricatorDisabledUserController' => 'applications/auth/controller/PhabricatorDisabledUserController.php', 'PhabricatorDisplayPreferencesSettingsPanel' => 'applications/settings/panel/PhabricatorDisplayPreferencesSettingsPanel.php', 'PhabricatorDisqusAuthProvider' => 'applications/auth/provider/PhabricatorDisqusAuthProvider.php', - 'PhabricatorDisqusConfigOptions' => 'applications/config/option/PhabricatorDisqusConfigOptions.php', 'PhabricatorDivinerApplication' => 'applications/diviner/application/PhabricatorDivinerApplication.php', 'PhabricatorDoorkeeperApplication' => 'applications/doorkeeper/application/PhabricatorDoorkeeperApplication.php', 'PhabricatorDraft' => 'applications/draft/storage/PhabricatorDraft.php', @@ -6155,7 +6154,6 @@ 'PhabricatorDisabledUserController' => 'PhabricatorAuthController', 'PhabricatorDisplayPreferencesSettingsPanel' => 'PhabricatorSettingsPanel', 'PhabricatorDisqusAuthProvider' => 'PhabricatorOAuth2AuthProvider', - 'PhabricatorDisqusConfigOptions' => 'PhabricatorApplicationConfigOptions', 'PhabricatorDivinerApplication' => 'PhabricatorApplication', 'PhabricatorDoorkeeperApplication' => 'PhabricatorApplication', 'PhabricatorDraft' => 'PhabricatorDraftDAO', diff --git a/src/applications/config/option/PhabricatorDisqusConfigOptions.php b/src/applications/config/option/PhabricatorDisqusConfigOptions.php deleted file mode 100644 --- a/src/applications/config/option/PhabricatorDisqusConfigOptions.php +++ /dev/null @@ -1,35 +0,0 @@ -newOption('disqus.shortname', 'string', null) - ->setSummary(pht('Shortname for Disqus comment widget.')) - ->setDescription( - pht( - "Website shortname to use for Disqus comment widget in Phame. ". - "For more information, see:\n\n". - "[[http://docs.disqus.com/help/4/ | Disqus Quick Start Guide]]\n". - "[[http://docs.disqus.com/help/68/ | Information on Shortnames]]")), - ); - } - -} diff --git a/src/applications/phame/controller/post/PhamePostEditController.php b/src/applications/phame/controller/post/PhamePostEditController.php --- a/src/applications/phame/controller/post/PhamePostEditController.php +++ b/src/applications/phame/controller/post/PhamePostEditController.php @@ -55,7 +55,6 @@ $title = $post->getTitle(); $phame_title = $post->getPhameTitle(); $body = $post->getBody(); - $comments_widget = $post->getCommentsWidget(); $visibility = $post->getVisibility(); $e_title = true; @@ -66,7 +65,6 @@ $phame_title = $request->getStr('phame_title'); $phame_title = PhabricatorSlug::normalize($phame_title); $body = $request->getStr('body'); - $comments_widget = $request->getStr('comments_widget'); $v_projects = $request->getArr('projects'); $v_cc = $request->getArr('cc'); $visibility = $request->getInt('visibility'); @@ -85,9 +83,6 @@ ->setTransactionType(PhamePostTransaction::TYPE_VISIBILITY) ->setNewValue($visibility), id(new PhamePostTransaction()) - ->setTransactionType(PhamePostTransaction::TYPE_COMMENTS_WIDGET) - ->setNewValue($comments_widget), - id(new PhamePostTransaction()) ->setTransactionType(PhabricatorTransactions::TYPE_SUBSCRIBERS) ->setNewValue(array('=' => $v_cc)), @@ -176,12 +171,6 @@ ->setValue($v_projects) ->setDatasource(new PhabricatorProjectDatasource())) ->appendChild( - id(new AphrontFormSelectControl()) - ->setLabel(pht('Comments Widget')) - ->setName('comments_widget') - ->setvalue($comments_widget) - ->setOptions($post->getCommentsWidgetOptionsForSelect())) - ->appendChild( id(new AphrontFormSubmitControl()) ->addCancelButton($cancel_uri) ->setValue($submit_button)); diff --git a/src/applications/phame/editor/PhamePostEditor.php b/src/applications/phame/editor/PhamePostEditor.php --- a/src/applications/phame/editor/PhamePostEditor.php +++ b/src/applications/phame/editor/PhamePostEditor.php @@ -18,7 +18,6 @@ $types[] = PhamePostTransaction::TYPE_PHAME_TITLE; $types[] = PhamePostTransaction::TYPE_BODY; $types[] = PhamePostTransaction::TYPE_VISIBILITY; - $types[] = PhamePostTransaction::TYPE_COMMENTS_WIDGET; return $types; } @@ -36,8 +35,6 @@ return $object->getBody(); case PhamePostTransaction::TYPE_VISIBILITY: return $object->getVisibility(); - case PhamePostTransaction::TYPE_COMMENTS_WIDGET: - return $object->getCommentsWidget(); } } @@ -50,7 +47,6 @@ case PhamePostTransaction::TYPE_PHAME_TITLE: case PhamePostTransaction::TYPE_BODY: case PhamePostTransaction::TYPE_VISIBILITY: - case PhamePostTransaction::TYPE_COMMENTS_WIDGET: return $xaction->getNewValue(); } } @@ -73,8 +69,6 @@ $object->setDatePublished(0); } return $object->setVisibility($xaction->getNewValue()); - case PhamePostTransaction::TYPE_COMMENTS_WIDGET: - return $object->setCommentsWidget($xaction->getNewValue()); } return parent::applyCustomInternalTransaction($object, $xaction); @@ -89,7 +83,6 @@ case PhamePostTransaction::TYPE_PHAME_TITLE: case PhamePostTransaction::TYPE_BODY: case PhamePostTransaction::TYPE_VISIBILITY: - case PhamePostTransaction::TYPE_COMMENTS_WIDGET: return; } diff --git a/src/applications/phame/storage/PhamePost.php b/src/applications/phame/storage/PhamePost.php --- a/src/applications/phame/storage/PhamePost.php +++ b/src/applications/phame/storage/PhamePost.php @@ -76,20 +76,6 @@ return $name; } - public function setCommentsWidget($widget) { - $config_data = $this->getConfigData(); - $config_data['comments_widget'] = $widget; - return $this; - } - - public function getCommentsWidget() { - $config_data = $this->getConfigData(); - if (empty($config_data)) { - return 'none'; - } - return idx($config_data, 'comments_widget', 'none'); - } - protected function getConfiguration() { return array( self::CONFIG_AUX_PHID => true, @@ -162,23 +148,6 @@ ); } - public function getCommentsWidgetOptionsForSelect() { - $current = $this->getCommentsWidget(); - $options = array(); - - if ($current == 'facebook' || - PhabricatorFacebookAuthProvider::getFacebookApplicationID()) { - $options['facebook'] = pht('Facebook'); - } - if ($current == 'disqus' || - PhabricatorEnv::getEnvConfig('disqus.shortname')) { - $options['disqus'] = pht('Disqus'); - } - $options['none'] = pht('None'); - - return $options; - } - /* -( PhabricatorPolicyInterface Implementation )-------------------------- */ diff --git a/src/applications/phame/storage/PhamePostTransaction.php b/src/applications/phame/storage/PhamePostTransaction.php --- a/src/applications/phame/storage/PhamePostTransaction.php +++ b/src/applications/phame/storage/PhamePostTransaction.php @@ -7,7 +7,6 @@ const TYPE_PHAME_TITLE = 'phame.post.phame.title'; const TYPE_BODY = 'phame.post.body'; const TYPE_VISIBILITY = 'phame.post.visibility'; - const TYPE_COMMENTS_WIDGET = 'phame.post.comments.widget'; const MAILTAG_CONTENT = 'phame-post-content'; const MAILTAG_COMMENT = 'phame-post-comment'; @@ -56,7 +55,6 @@ case self::TYPE_PHAME_TITLE: case self::TYPE_BODY: case self::TYPE_VISIBILITY: - case self::TYPE_COMMENTS_WIDGET: return 'fa-pencil'; break; } @@ -67,7 +65,6 @@ $tags = parent::getMailTags(); switch ($this->getTransactionType()) { - case self::TYPE_COMMENTS_WIDGET: case PhabricatorTransactions::TYPE_COMMENT: $tags[] = self::MAILTAG_COMMENT; break; @@ -127,12 +124,6 @@ $this->renderHandleLink($author_phid), rtrim($new, '/')); break; - case self::TYPE_COMMENTS_WIDGET: - return pht( - '%s updated the post\'s comment widget to "%s".', - $this->renderHandleLink($author_phid), - $new); - break; } return parent::getTitle(); @@ -185,12 +176,6 @@ $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid)); break; - case self::TYPE_COMMENTS_WIDGET: - return pht( - '%s updated the comments widget for %s.', - $this->renderHandleLink($author_phid), - $this->renderHandleLink($object_phid)); - break; } return parent::getTitleForFeed(); diff --git a/src/applications/phame/view/PhamePostView.php b/src/applications/phame/view/PhamePostView.php --- a/src/applications/phame/view/PhamePostView.php +++ b/src/applications/phame/view/PhamePostView.php @@ -101,24 +101,6 @@ $this->getSummary()); } - public function renderComments() { - $post = $this->getPost(); - - switch ($post->getCommentsWidget()) { - case 'facebook': - $comments = $this->renderFacebookComments(); - break; - case 'disqus': - $comments = $this->renderDisqusComments(); - break; - case 'none': - default: - $comments = null; - break; - } - return $comments; - } - public function render() { return phutil_tag( 'div', @@ -129,7 +111,6 @@ $this->renderTitle(), $this->renderDatePublished(), $this->renderBody(), - $this->renderComments(), )); } @@ -146,96 +127,4 @@ )); } - private function renderFacebookComments() { - $fb_id = PhabricatorFacebookAuthProvider::getFacebookApplicationID(); - if (!$fb_id) { - return null; - } - - $fb_root = phutil_tag('div', - array( - 'id' => 'fb-root', - ), - ''); - - $c_uri = '//connect.facebook.net/en_US/all.js#xfbml=1&appId='.$fb_id; - $fb_js = CelerityStaticResourceResponse::renderInlineScript( - jsprintf( - '(function(d, s, id) {'. - ' var js, fjs = d.getElementsByTagName(s)[0];'. - ' if (d.getElementById(id)) return;'. - ' js = d.createElement(s); js.id = id;'. - ' js.src = %s;'. - ' fjs.parentNode.insertBefore(js, fjs);'. - '}(document, \'script\', \'facebook-jssdk\'));', - $c_uri)); - - - $uri = $this->getSkin()->getURI('post/'.$this->getPost()->getPhameTitle()); - - require_celerity_resource('phame-css'); - $fb_comments = phutil_tag('div', - array( - 'class' => 'fb-comments', - 'data-href' => $uri, - 'data-num-posts' => 5, - ), - ''); - - return phutil_tag( - 'div', - array( - 'class' => 'phame-comments-facebook', - ), - array( - $fb_root, - $fb_js, - $fb_comments, - )); - } - - private function renderDisqusComments() { - $disqus_shortname = PhabricatorEnv::getEnvConfig('disqus.shortname'); - if (!$disqus_shortname) { - return null; - } - - $post = $this->getPost(); - - $disqus_thread = phutil_tag('div', - array( - 'id' => 'disqus_thread', - )); - - // protip - try some var disqus_developer = 1; action to test locally - $disqus_js = CelerityStaticResourceResponse::renderInlineScript( - jsprintf( - ' var disqus_shortname = %s;'. - ' var disqus_identifier = %s;'. - ' var disqus_url = %s;'. - ' var disqus_title = %s;'. - '(function() {'. - ' var dsq = document.createElement("script");'. - ' dsq.type = "text/javascript";'. - ' dsq.async = true;'. - ' dsq.src = "//" + disqus_shortname + ".disqus.com/embed.js";'. - '(document.getElementsByTagName("head")[0] ||'. - ' document.getElementsByTagName("body")[0]).appendChild(dsq);'. - '})();', - $disqus_shortname, - $post->getPHID(), - $this->getSkin()->getURI('post/'.$this->getPost()->getPhameTitle()), - $post->getTitle())); - - return phutil_tag( - 'div', - array( - 'class' => 'phame-comments-disqus', - ), - array( - $disqus_thread, - $disqus_js, - )); - } - }