mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-23 15:22:41 +01:00
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
This commit is contained in:
parent
d8111f828f
commit
ada7d45a00
7 changed files with 0 additions and 212 deletions
|
@ -2095,7 +2095,6 @@ phutil_register_library_map(array(
|
|||
'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 @@ phutil_register_library_map(array(
|
|||
'PhabricatorDisabledUserController' => 'PhabricatorAuthController',
|
||||
'PhabricatorDisplayPreferencesSettingsPanel' => 'PhabricatorSettingsPanel',
|
||||
'PhabricatorDisqusAuthProvider' => 'PhabricatorOAuth2AuthProvider',
|
||||
'PhabricatorDisqusConfigOptions' => 'PhabricatorApplicationConfigOptions',
|
||||
'PhabricatorDivinerApplication' => 'PhabricatorApplication',
|
||||
'PhabricatorDoorkeeperApplication' => 'PhabricatorApplication',
|
||||
'PhabricatorDraft' => 'PhabricatorDraftDAO',
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorDisqusConfigOptions
|
||||
extends PhabricatorApplicationConfigOptions {
|
||||
|
||||
public function getName() {
|
||||
return pht('Integration with Disqus');
|
||||
}
|
||||
|
||||
public function getDescription() {
|
||||
return pht('Disqus authentication and integration options.');
|
||||
}
|
||||
|
||||
public function getFontIcon() {
|
||||
return 'fa-comment';
|
||||
}
|
||||
|
||||
public function getGroup() {
|
||||
return 'core';
|
||||
}
|
||||
|
||||
public function getOptions() {
|
||||
return array(
|
||||
$this->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]]")),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
|
@ -55,7 +55,6 @@ final class PhamePostEditController extends PhamePostController {
|
|||
$title = $post->getTitle();
|
||||
$phame_title = $post->getPhameTitle();
|
||||
$body = $post->getBody();
|
||||
$comments_widget = $post->getCommentsWidget();
|
||||
$visibility = $post->getVisibility();
|
||||
|
||||
$e_title = true;
|
||||
|
@ -66,7 +65,6 @@ final class PhamePostEditController extends PhamePostController {
|
|||
$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');
|
||||
|
@ -84,9 +82,6 @@ final class PhamePostEditController extends PhamePostController {
|
|||
id(new PhamePostTransaction())
|
||||
->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)),
|
||||
|
@ -175,12 +170,6 @@ final class PhamePostEditController extends PhamePostController {
|
|||
->setName('projects')
|
||||
->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)
|
||||
|
|
|
@ -18,7 +18,6 @@ final class PhamePostEditor
|
|||
$types[] = PhamePostTransaction::TYPE_PHAME_TITLE;
|
||||
$types[] = PhamePostTransaction::TYPE_BODY;
|
||||
$types[] = PhamePostTransaction::TYPE_VISIBILITY;
|
||||
$types[] = PhamePostTransaction::TYPE_COMMENTS_WIDGET;
|
||||
|
||||
return $types;
|
||||
}
|
||||
|
@ -36,8 +35,6 @@ final class PhamePostEditor
|
|||
return $object->getBody();
|
||||
case PhamePostTransaction::TYPE_VISIBILITY:
|
||||
return $object->getVisibility();
|
||||
case PhamePostTransaction::TYPE_COMMENTS_WIDGET:
|
||||
return $object->getCommentsWidget();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,7 +47,6 @@ final class PhamePostEditor
|
|||
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 @@ final class PhamePostEditor
|
|||
$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 @@ final class PhamePostEditor
|
|||
case PhamePostTransaction::TYPE_PHAME_TITLE:
|
||||
case PhamePostTransaction::TYPE_BODY:
|
||||
case PhamePostTransaction::TYPE_VISIBILITY:
|
||||
case PhamePostTransaction::TYPE_COMMENTS_WIDGET:
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -76,20 +76,6 @@ final class PhamePost extends PhameDAO
|
|||
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 @@ final class PhamePost extends PhameDAO
|
|||
);
|
||||
}
|
||||
|
||||
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 )-------------------------- */
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ final class PhamePostTransaction
|
|||
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 @@ final class PhamePostTransaction
|
|||
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 @@ final class PhamePostTransaction
|
|||
$tags = parent::getMailTags();
|
||||
|
||||
switch ($this->getTransactionType()) {
|
||||
case self::TYPE_COMMENTS_WIDGET:
|
||||
case PhabricatorTransactions::TYPE_COMMENT:
|
||||
$tags[] = self::MAILTAG_COMMENT;
|
||||
break;
|
||||
|
@ -127,12 +124,6 @@ final class PhamePostTransaction
|
|||
$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 @@ final class PhamePostTransaction
|
|||
$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();
|
||||
|
|
|
@ -101,24 +101,6 @@ final class PhamePostView extends AphrontView {
|
|||
$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 @@ final class PhamePostView extends AphrontView {
|
|||
$this->renderTitle(),
|
||||
$this->renderDatePublished(),
|
||||
$this->renderBody(),
|
||||
$this->renderComments(),
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -146,96 +127,4 @@ final class PhamePostView extends AphrontView {
|
|||
));
|
||||
}
|
||||
|
||||
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,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue