Separate "your questions" from "your answers"

Summary: The aoff/qoff thing is pretty awkward and putting these both on the same page is probably only at all useful when looking at someone else's questions/answers -- we should just pursue main profile integration for that.

Test Plan: {F19529}

Reviewers: pieter, starruler

Reviewed By: pieter

CC: aran

Maniphest Tasks: T1644

Differential Revision: https://secure.phabricator.com/D3512
This commit is contained in:
epriestley
2012-09-30 20:09:39 -07:00
parent 9d87510ff3
commit da627522ca
4 changed files with 27 additions and 72 deletions

View File

@@ -46,8 +46,9 @@ abstract class PonderController extends PhabricatorController {
$side_nav->addSpacer();
$side_nav->addLabel('Profile');
$side_nav->addFilter('profile', 'User Profile');
$side_nav->addLabel('User');
$side_nav->addFilter('questions', 'Your Questions');
$side_nav->addFilter('answers', 'Your Answers');
return $side_nav;
}

View File

@@ -39,8 +39,9 @@ final class PonderFeedController extends PonderController {
$this->answerOffset = $request->getInt('aoff');
$pages = array(
'feed' => 'All Questions',
'profile' => 'User Profile',
'feed' => 'All Questions',
'questions' => 'Your Questions',
'answers' => 'Your Answers',
);
$side_nav = $this->buildSideNavView();
@@ -51,10 +52,21 @@ final class PonderFeedController extends PonderController {
switch ($this->page) {
case 'feed':
$questions = PonderQuestionQuery::loadHottest(
$user,
$this->feedOffset,
self::FEED_PAGE_SIZE + 1);
case 'questions':
if ($this->page == 'feed') {
$questions = PonderQuestionQuery::loadHottest(
$user,
$this->feedOffset,
self::FEED_PAGE_SIZE + 1);
} else {
$questions = PonderQuestionQuery::loadByAuthor(
$user,
$user->getPHID(),
$this->questionOffset,
self::PROFILE_QUESTION_PAGE_SIZE + 1
);
}
$this->loadHandles(mpull($questions, 'getAuthorPHID'));
@@ -63,14 +75,7 @@ final class PonderFeedController extends PonderController {
id(new PhabricatorHeaderView())->setHeader($title));
$side_nav->appendChild($view);
break;
case 'profile':
$questions = PonderQuestionQuery::loadByAuthor(
$user,
$user->getPHID(),
$this->questionOffset,
self::PROFILE_QUESTION_PAGE_SIZE + 1
);
case 'answers':
$answers = PonderAnswerQuery::loadByAuthorWithQuestions(
$user,
$user->getPHID(),
@@ -84,13 +89,11 @@ final class PonderFeedController extends PonderController {
$side_nav->appendChild(
id(new PonderUserProfileView())
->setUser($user)
->setQuestions($questions)
->setAnswers($answers)
->setHandles($handles)
->setQuestionOffset($this->questionOffset)
->setAnswerOffset($this->answerOffset)
->setPageSize(self::PROFILE_QUESTION_PAGE_SIZE)
->setURI(new PhutilURI("/ponder/profile/"), "qoff", "aoff")
->setURI(new PhutilURI("/ponder/profile/"), "aoff")
);
break;
}