diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index cf8fc0b533..1d631b8652 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -2840,6 +2840,7 @@ phutil_register_library_map(array( 'PonderAnswerCommentController' => 'applications/ponder/controller/PonderAnswerCommentController.php', 'PonderAnswerEditController' => 'applications/ponder/controller/PonderAnswerEditController.php', 'PonderAnswerEditor' => 'applications/ponder/editor/PonderAnswerEditor.php', + 'PonderAnswerHasVotingUserEdgeType' => 'applications/ponder/edge/PonderAnswerHasVotingUserEdgeType.php', 'PonderAnswerHistoryController' => 'applications/ponder/controller/PonderAnswerHistoryController.php', 'PonderAnswerPHIDType' => 'applications/ponder/phid/PonderAnswerPHIDType.php', 'PonderAnswerQuery' => 'applications/ponder/query/PonderAnswerQuery.php', @@ -2855,6 +2856,7 @@ phutil_register_library_map(array( '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', @@ -2877,6 +2879,8 @@ phutil_register_library_map(array( 'PonderVote' => 'applications/ponder/constants/PonderVote.php', 'PonderVoteEditor' => 'applications/ponder/editor/PonderVoteEditor.php', 'PonderVoteSaveController' => 'applications/ponder/controller/PonderVoteSaveController.php', + 'PonderVotingUserHasAnswerEdgeType' => 'applications/ponder/edge/PonderVotingUserHasAnswerEdgeType.php', + 'PonderVotingUserHasQuestionEdgeType' => 'applications/ponder/edge/PonderVotingUserHasQuestionEdgeType.php', 'ProjectBoardTaskCard' => 'applications/project/view/ProjectBoardTaskCard.php', 'ProjectCanLockProjectsCapability' => 'applications/project/capability/ProjectCanLockProjectsCapability.php', 'ProjectConduitAPIMethod' => 'applications/project/conduit/ProjectConduitAPIMethod.php', @@ -6143,6 +6147,7 @@ phutil_register_library_map(array( 'PonderAnswerCommentController' => 'PonderController', 'PonderAnswerEditController' => 'PonderController', 'PonderAnswerEditor' => 'PonderEditor', + 'PonderAnswerHasVotingUserEdgeType' => 'PhabricatorEdgeType', 'PonderAnswerHistoryController' => 'PonderController', 'PonderAnswerPHIDType' => 'PhabricatorPHIDType', 'PonderAnswerQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', @@ -6168,6 +6173,7 @@ phutil_register_library_map(array( 'PonderQuestionCommentController' => 'PonderController', 'PonderQuestionEditController' => 'PonderController', 'PonderQuestionEditor' => 'PonderEditor', + 'PonderQuestionHasVotingUserEdgeType' => 'PhabricatorEdgeType', 'PonderQuestionHistoryController' => 'PonderController', 'PonderQuestionListController' => 'PonderController', 'PonderQuestionMailReceiver' => 'PhabricatorObjectMailReceiver', @@ -6189,6 +6195,8 @@ phutil_register_library_map(array( 'PonderVote' => 'PonderConstants', 'PonderVoteEditor' => 'PhabricatorEditor', 'PonderVoteSaveController' => 'PonderController', + 'PonderVotingUserHasAnswerEdgeType' => 'PhabricatorEdgeType', + 'PonderVotingUserHasQuestionEdgeType' => 'PhabricatorEdgeType', 'ProjectCanLockProjectsCapability' => 'PhabricatorPolicyCapability', 'ProjectConduitAPIMethod' => 'ConduitAPIMethod', 'ProjectCreateConduitAPIMethod' => 'ProjectConduitAPIMethod', diff --git a/src/applications/ponder/edge/PonderAnswerHasVotingUserEdgeType.php b/src/applications/ponder/edge/PonderAnswerHasVotingUserEdgeType.php new file mode 100644 index 0000000000..74447dbf0d --- /dev/null +++ b/src/applications/ponder/edge/PonderAnswerHasVotingUserEdgeType.php @@ -0,0 +1,105 @@ +needViewerVotes) { $viewer_phid = $this->getViewer()->getPHID(); - $etype = PhabricatorEdgeConfig::TYPE_ANSWER_HAS_VOTING_USER; + $etype = PonderAnswerHasVotingUserEdgeType::EDGECONST; $edges = id(new PhabricatorEdgeQuery()) ->withSourcePHIDs(mpull($answers, 'getPHID')) ->withDestinationPHIDs(array($viewer_phid)) diff --git a/src/applications/ponder/query/PonderQuestionQuery.php b/src/applications/ponder/query/PonderQuestionQuery.php index 132362a8d3..4680393476 100644 --- a/src/applications/ponder/query/PonderQuestionQuery.php +++ b/src/applications/ponder/query/PonderQuestionQuery.php @@ -159,7 +159,7 @@ final class PonderQuestionQuery if ($this->needViewerVotes) { $viewer_phid = $this->getViewer()->getPHID(); - $etype = PhabricatorEdgeConfig::TYPE_QUESTION_HAS_VOTING_USER; + $etype = PonderQuestionHasVotingUserEdgeType::EDGECONST; $edges = id(new PhabricatorEdgeQuery()) ->withSourcePHIDs(mpull($questions, 'getPHID')) ->withDestinationPHIDs(array($viewer_phid)) diff --git a/src/applications/ponder/storage/PonderAnswer.php b/src/applications/ponder/storage/PonderAnswer.php index 7e6cdbd19e..e06435a7d2 100644 --- a/src/applications/ponder/storage/PonderAnswer.php +++ b/src/applications/ponder/storage/PonderAnswer.php @@ -166,7 +166,7 @@ final class PonderAnswer extends PonderDAO // votable interface public function getUserVoteEdgeType() { - return PhabricatorEdgeConfig::TYPE_VOTING_USER_HAS_ANSWER; + return PonderVotingUserHasAnswerEdgeType::EDGECONST; } public function getVotablePHID() { diff --git a/src/applications/ponder/storage/PonderQuestion.php b/src/applications/ponder/storage/PonderQuestion.php index 6237f48c9a..e2db7c0d48 100644 --- a/src/applications/ponder/storage/PonderQuestion.php +++ b/src/applications/ponder/storage/PonderQuestion.php @@ -87,16 +87,16 @@ final class PonderQuestion extends PonderDAO ->withDestinationPHIDs($qa_phids) ->withEdgeTypes( array( - PhabricatorEdgeConfig::TYPE_VOTING_USER_HAS_QUESTION, - PhabricatorEdgeConfig::TYPE_VOTING_USER_HAS_ANSWER, + PonderVotingUserHasQuestionEdgeType::EDGECONST, + PonderVotingUserHasAnswerEdgeType::EDGECONST, )) ->needEdgeData(true) ->execute(); $question_edge = - $edges[$user_phid][PhabricatorEdgeConfig::TYPE_VOTING_USER_HAS_QUESTION]; + $edges[$user_phid][PonderVotingUserHasQuestionEdgeType::EDGECONST]; $answer_edges = - $edges[$user_phid][PhabricatorEdgeConfig::TYPE_VOTING_USER_HAS_ANSWER]; + $edges[$user_phid][PonderVotingUserHasAnswerEdgeType::EDGECONST]; $edges = null; $this->setUserVote(idx($question_edge, $this->getPHID())); @@ -198,7 +198,7 @@ final class PonderQuestion extends PonderDAO // votable interface public function getUserVoteEdgeType() { - return PhabricatorEdgeConfig::TYPE_VOTING_USER_HAS_QUESTION; + return PonderVotingUserHasQuestionEdgeType::EDGECONST; } public function getVotablePHID() { diff --git a/src/infrastructure/edges/constants/PhabricatorEdgeConfig.php b/src/infrastructure/edges/constants/PhabricatorEdgeConfig.php index 46287a5dd5..5febf04c35 100644 --- a/src/infrastructure/edges/constants/PhabricatorEdgeConfig.php +++ b/src/infrastructure/edges/constants/PhabricatorEdgeConfig.php @@ -11,11 +11,6 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants { const TYPE_PROJ_MEMBER = 13; const TYPE_MEMBER_OF_PROJ = 14; - const TYPE_QUESTION_HAS_VOTING_USER = 17; - const TYPE_VOTING_USER_HAS_QUESTION = 18; - const TYPE_ANSWER_HAS_VOTING_USER = 19; - const TYPE_VOTING_USER_HAS_ANSWER = 20; - const TYPE_OBJECT_HAS_SUBSCRIBER = 21; const TYPE_SUBSCRIBED_TO_OBJECT = 22; @@ -123,13 +118,6 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants { self::TYPE_PROJ_MEMBER => self::TYPE_MEMBER_OF_PROJ, self::TYPE_MEMBER_OF_PROJ => self::TYPE_PROJ_MEMBER, - self::TYPE_QUESTION_HAS_VOTING_USER => - self::TYPE_VOTING_USER_HAS_QUESTION, - self::TYPE_VOTING_USER_HAS_QUESTION => - self::TYPE_QUESTION_HAS_VOTING_USER, - self::TYPE_ANSWER_HAS_VOTING_USER => self::TYPE_VOTING_USER_HAS_ANSWER, - self::TYPE_VOTING_USER_HAS_ANSWER => self::TYPE_ANSWER_HAS_VOTING_USER, - self::TYPE_OBJECT_HAS_SUBSCRIBER => self::TYPE_SUBSCRIBED_TO_OBJECT, self::TYPE_SUBSCRIBED_TO_OBJECT => self::TYPE_OBJECT_HAS_SUBSCRIBER, @@ -221,13 +209,6 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants { return '%s edited member(s), added %d: %s; removed %d: %s.'; case self::TYPE_MEMBER_OF_PROJ: return '%s edited project(s), added %d: %s; removed %d: %s.'; - case self::TYPE_QUESTION_HAS_VOTING_USER: - case self::TYPE_ANSWER_HAS_VOTING_USER: - return '%s edited voting user(s), added %d: %s; removed %d: %s.'; - case self::TYPE_VOTING_USER_HAS_QUESTION: - return '%s edited question(s), added %d: %s; removed %d: %s.'; - case self::TYPE_VOTING_USER_HAS_ANSWER: - return '%s edited answer(s), added %d: %s; removed %d: %s.'; case self::TYPE_OBJECT_HAS_SUBSCRIBER: return '%s edited subscriber(s), added %d: %s; removed %d: %s.'; case self::TYPE_SUBSCRIBED_TO_OBJECT: @@ -275,13 +256,6 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants { return '%s added %d member(s): %s.'; case self::TYPE_MEMBER_OF_PROJ: return '%s added %d project(s): %s.'; - case self::TYPE_QUESTION_HAS_VOTING_USER: - case self::TYPE_ANSWER_HAS_VOTING_USER: - return '%s added %d voting user(s): %s.'; - case self::TYPE_VOTING_USER_HAS_QUESTION: - return '%s added %d question(s): %s.'; - case self::TYPE_VOTING_USER_HAS_ANSWER: - return '%s added %d answer(s): %s.'; case self::TYPE_OBJECT_HAS_SUBSCRIBER: return '%s added %d subscriber(s): %s.'; case self::TYPE_OBJECT_HAS_UNSUBSCRIBER: @@ -325,13 +299,6 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants { return '%s removed %d member(s): %s.'; case self::TYPE_MEMBER_OF_PROJ: return '%s removed %d project(s): %s.'; - case self::TYPE_QUESTION_HAS_VOTING_USER: - case self::TYPE_ANSWER_HAS_VOTING_USER: - return '%s removed %d voting user(s): %s.'; - case self::TYPE_VOTING_USER_HAS_QUESTION: - return '%s removed %d question(s): %s.'; - case self::TYPE_VOTING_USER_HAS_ANSWER: - return '%s removed %d answer(s): %s.'; case self::TYPE_OBJECT_HAS_SUBSCRIBER: return '%s removed %d subscriber(s): %s.'; case self::TYPE_OBJECT_HAS_UNSUBSCRIBER: @@ -375,13 +342,6 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants { return '%s updated members of %s.'; case self::TYPE_MEMBER_OF_PROJ: return '%s updated projects of %s.'; - case self::TYPE_QUESTION_HAS_VOTING_USER: - case self::TYPE_ANSWER_HAS_VOTING_USER: - return '%s updated voting users of %s.'; - case self::TYPE_VOTING_USER_HAS_QUESTION: - return '%s updated questions of %s.'; - case self::TYPE_VOTING_USER_HAS_ANSWER: - return '%s updated answers of %s.'; case self::TYPE_OBJECT_HAS_SUBSCRIBER: return '%s updated subscribers of %s.'; case self::TYPE_OBJECT_HAS_UNSUBSCRIBER: diff --git a/src/infrastructure/internationalization/translation/PhabricatorBaseEnglishTranslation.php b/src/infrastructure/internationalization/translation/PhabricatorBaseEnglishTranslation.php index c80d58fba5..adf2f3f942 100644 --- a/src/infrastructure/internationalization/translation/PhabricatorBaseEnglishTranslation.php +++ b/src/infrastructure/internationalization/translation/PhabricatorBaseEnglishTranslation.php @@ -314,17 +314,17 @@ abstract class PhabricatorBaseEnglishTranslation ), ), - '%s edited voting user(s), added %d: %s; removed %d: %s.' => + '%s edited voting user(s), added %s: %s; removed %d: %s.' => '%s edited voting users, added: %3$s; removed: %5$s', - '%s added %d voting user(s): %s.' => array( + '%s added %s voting user(s): %s.' => array( array( '%s added a voting user: %3$s.', '%s added voting users: %3$s.', ), ), - '%s removed %d voting user(s): %s.' => array( + '%s removed %s voting user(s): %s.' => array( array( '%s removed a voting user: %3$s.', '%s removed voting users: %3$s.', @@ -399,34 +399,34 @@ abstract class PhabricatorBaseEnglishTranslation '%s edited blocked task(s) for %s, added %s: %s; removed %s: %s.' => '%s edited blocked tasks for %s, added: %4$s; removed: %6$s', - '%s edited answer(s), added %d: %s; removed %d: %s.' => + '%s edited answer(s), added %s: %s; removed %d: %s.' => '%s edited answers, added: %3$s; removed: %5$s', - '%s added %d answer(s): %s.' => array( + '%s added %s answer(s): %s.' => array( array( '%s added an answer: %3$s.', '%s added answers: %3$s.', ), ), - '%s removed %d answer(s): %s.' => array( + '%s removed %s answer(s): %s.' => array( array( '%s removed a answer: %3$s.', '%s removed answers: %3$s.', ), ), - '%s edited question(s), added %d: %s; removed %d: %s.' => + '%s edited question(s), added %s: %s; removed %s: %s.' => '%s edited questions, added: %3$s; removed: %5$s', - '%s added %d question(s): %s.' => array( + '%s added %s question(s): %s.' => array( array( '%s added a question: %3$s.', '%s added questions: %3$s.', ), ), - '%s removed %d question(s): %s.' => array( + '%s removed %s question(s): %s.' => array( array( '%s removed a question: %3$s.', '%s removed questions: %3$s.',