Page MenuHomePhabricator

D13833.diff
No OneTemporary

D13833.diff

diff --git a/resources/sql/autopatches/20150808.ponder.vote.1.sql b/resources/sql/autopatches/20150808.ponder.vote.1.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20150808.ponder.vote.1.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_ponder.ponder_question
+ DROP COLUMN heat;
diff --git a/resources/sql/autopatches/20150808.ponder.vote.2.sql b/resources/sql/autopatches/20150808.ponder.vote.2.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20150808.ponder.vote.2.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_ponder.ponder_question
+ DROP COLUMN voteCount;
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
@@ -3409,7 +3409,6 @@
'PonderQuestionCommentController' => 'applications/ponder/controller/PonderQuestionCommentController.php',
'PonderQuestionEditController' => 'applications/ponder/controller/PonderQuestionEditController.php',
'PonderQuestionEditor' => 'applications/ponder/editor/PonderQuestionEditor.php',
- 'PonderQuestionHasVotingUserEdgeType' => 'applications/ponder/edge/PonderQuestionHasVotingUserEdgeType.php',
'PonderQuestionHistoryController' => 'applications/ponder/controller/PonderQuestionHistoryController.php',
'PonderQuestionListController' => 'applications/ponder/controller/PonderQuestionListController.php',
'PonderQuestionMailReceiver' => 'applications/ponder/mail/PonderQuestionMailReceiver.php',
@@ -3432,7 +3431,6 @@
'PonderVoteEditor' => 'applications/ponder/editor/PonderVoteEditor.php',
'PonderVoteSaveController' => 'applications/ponder/controller/PonderVoteSaveController.php',
'PonderVotingUserHasAnswerEdgeType' => 'applications/ponder/edge/PonderVotingUserHasAnswerEdgeType.php',
- 'PonderVotingUserHasQuestionEdgeType' => 'applications/ponder/edge/PonderVotingUserHasQuestionEdgeType.php',
'ProjectAddProjectsEmailCommand' => 'applications/project/command/ProjectAddProjectsEmailCommand.php',
'ProjectBoardTaskCard' => 'applications/project/view/ProjectBoardTaskCard.php',
'ProjectCanLockProjectsCapability' => 'applications/project/capability/ProjectCanLockProjectsCapability.php',
@@ -7597,7 +7595,6 @@
'PonderDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorMarkupInterface',
- 'PonderVotableInterface',
'PhabricatorSubscribableInterface',
'PhabricatorFlaggableInterface',
'PhabricatorPolicyInterface',
@@ -7609,7 +7606,6 @@
'PonderQuestionCommentController' => 'PonderController',
'PonderQuestionEditController' => 'PonderController',
'PonderQuestionEditor' => 'PonderEditor',
- 'PonderQuestionHasVotingUserEdgeType' => 'PhabricatorEdgeType',
'PonderQuestionHistoryController' => 'PonderController',
'PonderQuestionListController' => 'PonderController',
'PonderQuestionMailReceiver' => 'PhabricatorObjectMailReceiver',
@@ -7631,7 +7627,6 @@
'PonderVoteEditor' => 'PhabricatorEditor',
'PonderVoteSaveController' => 'PonderController',
'PonderVotingUserHasAnswerEdgeType' => 'PhabricatorEdgeType',
- 'PonderVotingUserHasQuestionEdgeType' => 'PhabricatorEdgeType',
'ProjectAddProjectsEmailCommand' => 'MetaMTAEmailTransactionCommand',
'ProjectBoardTaskCard' => 'Phobject',
'ProjectCanLockProjectsCapability' => 'PhabricatorPolicyCapability',
diff --git a/src/applications/ponder/controller/PonderQuestionViewController.php b/src/applications/ponder/controller/PonderQuestionViewController.php
--- a/src/applications/ponder/controller/PonderQuestionViewController.php
+++ b/src/applications/ponder/controller/PonderQuestionViewController.php
@@ -10,14 +10,11 @@
->setViewer($viewer)
->withIDs(array($id))
->needAnswers(true)
- ->needViewerVotes(true)
->executeOne();
if (!$question) {
return new Aphront404Response();
}
- $question->attachVotes($viewer->getPHID());
-
$question_xactions = $this->buildQuestionTransactions($question);
$answers = $this->buildAnswers($question->getAnswers());
diff --git a/src/applications/ponder/edge/PonderQuestionHasVotingUserEdgeType.php b/src/applications/ponder/edge/PonderQuestionHasVotingUserEdgeType.php
deleted file mode 100644
--- a/src/applications/ponder/edge/PonderQuestionHasVotingUserEdgeType.php
+++ /dev/null
@@ -1,105 +0,0 @@
-<?php
-
-final class PonderQuestionHasVotingUserEdgeType extends PhabricatorEdgeType {
-
- const EDGECONST = 17;
-
- public function shouldWriteInverseTransactions() {
- return true;
- }
-
- public function getInverseEdgeConstant() {
- return PonderVotingUserHasQuestionEdgeType::EDGECONST;
- }
-
- public function getTransactionAddString(
- $actor,
- $add_count,
- $add_edges) {
-
- return pht(
- '%s added %s voting user(s): %s.',
- $actor,
- $add_count,
- $add_edges);
- }
-
- public function getTransactionRemoveString(
- $actor,
- $rem_count,
- $rem_edges) {
-
- return pht(
- '%s removed %s voting user(s): %s.',
- $actor,
- $rem_count,
- $rem_edges);
- }
-
- public function getTransactionEditString(
- $actor,
- $total_count,
- $add_count,
- $add_edges,
- $rem_count,
- $rem_edges) {
-
- return pht(
- '%s edited %s voting user(s), added %s: %s; removed %s: %s.',
- $actor,
- $total_count,
- $add_count,
- $add_edges,
- $rem_count,
- $rem_edges);
- }
-
- public function getFeedAddString(
- $actor,
- $object,
- $add_count,
- $add_edges) {
-
- return pht(
- '%s added %s voting user(s) to %s: %s.',
- $actor,
- $add_count,
- $object,
- $add_edges);
- }
-
- public function getFeedRemoveString(
- $actor,
- $object,
- $rem_count,
- $rem_edges) {
-
- return pht(
- '%s removed %s voting user(s) from %s: %s.',
- $actor,
- $rem_count,
- $object,
- $rem_edges);
- }
-
- public function getFeedEditString(
- $actor,
- $object,
- $total_count,
- $add_count,
- $add_edges,
- $rem_count,
- $rem_edges) {
-
- return pht(
- '%s edited %s voting user(s) for %s, added %s: %s; removed %s: %s.',
- $actor,
- $total_count,
- $object,
- $add_count,
- $add_edges,
- $rem_count,
- $rem_edges);
- }
-
-}
diff --git a/src/applications/ponder/edge/PonderVotingUserHasQuestionEdgeType.php b/src/applications/ponder/edge/PonderVotingUserHasQuestionEdgeType.php
deleted file mode 100644
--- a/src/applications/ponder/edge/PonderVotingUserHasQuestionEdgeType.php
+++ /dev/null
@@ -1,105 +0,0 @@
-<?php
-
-final class PonderVotingUserHasQuestionEdgeType extends PhabricatorEdgeType {
-
- const EDGECONST = 18;
-
- public function shouldWriteInverseTransactions() {
- return true;
- }
-
- public function getInverseEdgeConstant() {
- return PonderQuestionHasVotingUserEdgeType::EDGECONST;
- }
-
- public function getTransactionAddString(
- $actor,
- $add_count,
- $add_edges) {
-
- return pht(
- '%s added %s question(s): %s.',
- $actor,
- $add_count,
- $add_edges);
- }
-
- public function getTransactionRemoveString(
- $actor,
- $rem_count,
- $rem_edges) {
-
- return pht(
- '%s removed %s question(s): %s.',
- $actor,
- $rem_count,
- $rem_edges);
- }
-
- public function getTransactionEditString(
- $actor,
- $total_count,
- $add_count,
- $add_edges,
- $rem_count,
- $rem_edges) {
-
- return pht(
- '%s edited %s question(s), added %s: %s; removed %s: %s.',
- $actor,
- $total_count,
- $add_count,
- $add_edges,
- $rem_count,
- $rem_edges);
- }
-
- public function getFeedAddString(
- $actor,
- $object,
- $add_count,
- $add_edges) {
-
- return pht(
- '%s added %s question(s) to %s: %s.',
- $actor,
- $add_count,
- $object,
- $add_edges);
- }
-
- public function getFeedRemoveString(
- $actor,
- $object,
- $rem_count,
- $rem_edges) {
-
- return pht(
- '%s removed %s question(s) from %s: %s.',
- $actor,
- $rem_count,
- $object,
- $rem_edges);
- }
-
- public function getFeedEditString(
- $actor,
- $object,
- $total_count,
- $add_count,
- $add_edges,
- $rem_count,
- $rem_edges) {
-
- return pht(
- '%s edited %s question(s) for %s, added %s: %s; removed %s: %s.',
- $actor,
- $total_count,
- $object,
- $add_count,
- $add_edges,
- $rem_count,
- $rem_edges);
- }
-
-}
diff --git a/src/applications/ponder/query/PonderQuestionQuery.php b/src/applications/ponder/query/PonderQuestionQuery.php
--- a/src/applications/ponder/query/PonderQuestionQuery.php
+++ b/src/applications/ponder/query/PonderQuestionQuery.php
@@ -12,7 +12,6 @@
private $needProjectPHIDs;
private $needAnswers;
- private $needViewerVotes;
public function withIDs(array $ids) {
$this->ids = $ids;
@@ -44,11 +43,6 @@
return $this;
}
- public function needViewerVotes($need_viewer_votes) {
- $this->needViewerVotes = $need_viewer_votes;
- return $this;
- }
-
public function needProjectPHIDs($need_projects) {
$this->needProjectPHIDs = $need_projects;
return $this;
@@ -106,10 +100,6 @@
->setOrderVector(array('-id'))
->withQuestionIDs(mpull($questions, 'getID'));
- if ($this->needViewerVotes) {
- $aquery->needViewerVotes($this->needViewerVotes);
- }
-
$answers = $aquery->execute();
$answers = mgroup($answers, 'getQuestionID');
@@ -119,26 +109,6 @@
}
}
- if ($this->needViewerVotes) {
- $viewer_phid = $this->getViewer()->getPHID();
-
- $etype = PonderQuestionHasVotingUserEdgeType::EDGECONST;
- $edges = id(new PhabricatorEdgeQuery())
- ->withSourcePHIDs($phids)
- ->withDestinationPHIDs(array($viewer_phid))
- ->withEdgeTypes(array($etype))
- ->needEdgeData(true)
- ->execute();
- foreach ($questions as $question) {
- $user_edge = idx(
- $edges[$question->getPHID()][$etype],
- $viewer_phid,
- array());
-
- $question->attachUserVote($viewer_phid, idx($user_edge, 'data', 0));
- }
- }
-
if ($this->needProjectPHIDs) {
$edge_query = id(new PhabricatorEdgeQuery())
->withSourcePHIDs($phids)
diff --git a/src/applications/ponder/storage/PonderQuestion.php b/src/applications/ponder/storage/PonderQuestion.php
--- a/src/applications/ponder/storage/PonderQuestion.php
+++ b/src/applications/ponder/storage/PonderQuestion.php
@@ -4,7 +4,6 @@
implements
PhabricatorApplicationTransactionInterface,
PhabricatorMarkupInterface,
- PonderVotableInterface,
PhabricatorSubscribableInterface,
PhabricatorFlaggableInterface,
PhabricatorPolicyInterface,
@@ -25,13 +24,10 @@
protected $viewPolicy;
protected $spacePHID;
- protected $voteCount;
protected $answerCount;
- protected $heat;
protected $mailKey;
private $answers;
- private $vote;
private $comments;
private $projectPHIDs = self::ATTACHABLE;
@@ -49,9 +45,7 @@
->setAuthorPHID($actor->getPHID())
->setViewPolicy($view_policy)
->setStatus(PonderQuestionStatus::STATUS_OPEN)
- ->setVoteCount(0)
->setAnswerCount(0)
- ->setHeat(0.0)
->setSpacePHID($actor->getDefaultSpacePHID());
}
@@ -60,10 +54,8 @@
self::CONFIG_AUX_PHID => true,
self::CONFIG_COLUMN_SCHEMA => array(
'title' => 'text255',
- 'voteCount' => 'sint32',
'status' => 'text32',
'content' => 'text',
- 'heat' => 'double',
'answerCount' => 'uint32',
'mailKey' => 'bytes20',
@@ -80,9 +72,6 @@
'authorPHID' => array(
'columns' => array('authorPHID'),
),
- 'heat' => array(
- 'columns' => array('heat'),
- ),
'status' => array(
'columns' => array('status'),
),
@@ -103,49 +92,6 @@
return PhabricatorContentSource::newFromSerialized($this->contentSource);
}
- public function attachVotes($user_phid) {
- $qa_phids = mpull($this->answers, 'getPHID') + array($this->getPHID());
-
- $edges = id(new PhabricatorEdgeQuery())
- ->withSourcePHIDs(array($user_phid))
- ->withDestinationPHIDs($qa_phids)
- ->withEdgeTypes(
- array(
- PonderVotingUserHasQuestionEdgeType::EDGECONST,
- PonderVotingUserHasAnswerEdgeType::EDGECONST,
- ))
- ->needEdgeData(true)
- ->execute();
-
- $question_edge =
- $edges[$user_phid][PonderVotingUserHasQuestionEdgeType::EDGECONST];
- $answer_edges =
- $edges[$user_phid][PonderVotingUserHasAnswerEdgeType::EDGECONST];
- $edges = null;
-
- $this->setUserVote(idx($question_edge, $this->getPHID()));
- foreach ($this->answers as $answer) {
- $answer->setUserVote(idx($answer_edges, $answer->getPHID()));
- }
- }
-
- public function setUserVote($vote) {
- $this->vote = $vote['data'];
- if (!$this->vote) {
- $this->vote = PonderVote::VOTE_NONE;
- }
- return $this;
- }
-
- public function attachUserVote($user_phid, $vote) {
- $this->vote = $vote;
- return $this;
- }
-
- public function getUserVote() {
- return $this->vote;
- }
-
public function setComments($comments) {
$this->comments = $comments;
return $this;
@@ -229,15 +175,6 @@
return (bool)$this->getID();
}
- // votable interface
- public function getUserVoteEdgeType() {
- return PonderVotingUserHasQuestionEdgeType::EDGECONST;
- }
-
- public function getVotablePHID() {
- return $this->getPHID();
- }
-
public function save() {
if (!$this->getMailKey()) {
$this->setMailKey(Filesystem::readRandomCharacters(20));

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 11, 11:42 PM (6 d, 12 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6722584
Default Alt Text
D13833.diff (13 KB)

Event Timeline