Page MenuHomePhabricator

D13833.id33408.diff
No OneTemporary

D13833.id33408.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
@@ -7597,7 +7597,6 @@
'PonderDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorMarkupInterface',
- 'PonderVotableInterface',
'PhabricatorSubscribableInterface',
'PhabricatorFlaggableInterface',
'PhabricatorPolicyInterface',
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/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
Wed, Dec 18, 7:03 PM (2 h, 3 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6903983
Default Alt Text
D13833.id33408.diff (6 KB)

Event Timeline