Page MenuHomePhabricator

D15412.id37161.diff
No OneTemporary

D15412.id37161.diff

diff --git a/src/applications/badges/view/PhabricatorBadgesRecipientsListView.php b/src/applications/badges/view/PhabricatorBadgesRecipientsListView.php
--- a/src/applications/badges/view/PhabricatorBadgesRecipientsListView.php
+++ b/src/applications/badges/view/PhabricatorBadgesRecipientsListView.php
@@ -16,8 +16,7 @@
}
public function render() {
-
- $viewer = $this->user;
+ $viewer = $this->getViewer();
$badge = $this->badge;
$handles = $this->handles;
diff --git a/src/applications/daemon/view/PhabricatorDaemonLogEventsView.php b/src/applications/daemon/view/PhabricatorDaemonLogEventsView.php
--- a/src/applications/daemon/view/PhabricatorDaemonLogEventsView.php
+++ b/src/applications/daemon/view/PhabricatorDaemonLogEventsView.php
@@ -24,12 +24,9 @@
}
public function render() {
+ $viewer = $this->getViewer();
$rows = array();
- if (!$this->user) {
- throw new PhutilInvalidStateException('setUser');
- }
-
foreach ($this->events as $event) {
// Limit display log size. If a daemon gets stuck in an output loop this
@@ -83,8 +80,8 @@
$row = array(
$event->getLogType(),
- phabricator_date($event->getEpoch(), $this->user),
- phabricator_time($event->getEpoch(), $this->user),
+ phabricator_date($event->getEpoch(), $viewer),
+ phabricator_time($event->getEpoch(), $viewer),
array(
$message,
$more,
diff --git a/src/applications/daemon/view/PhabricatorDaemonLogListView.php b/src/applications/daemon/view/PhabricatorDaemonLogListView.php
--- a/src/applications/daemon/view/PhabricatorDaemonLogListView.php
+++ b/src/applications/daemon/view/PhabricatorDaemonLogListView.php
@@ -11,11 +11,9 @@
}
public function render() {
- $rows = array();
+ $viewer = $this->getViewer();
- if (!$this->user) {
- throw new PhutilInvalidStateException('setUser');
- }
+ $rows = array();
$list = new PHUIObjectItemListView();
$list->setFlush(true);
@@ -27,7 +25,7 @@
->setObjectName(pht('Daemon %s', $id))
->setHeader($log->getDaemon())
->setHref("/daemon/log/{$id}/")
- ->addIcon('none', phabricator_datetime($epoch, $this->user));
+ ->addIcon('none', phabricator_datetime($epoch, $viewer));
$status = $log->getStatus();
switch ($status) {
diff --git a/src/applications/differential/view/DifferentialAddCommentView.php b/src/applications/differential/view/DifferentialAddCommentView.php
--- a/src/applications/differential/view/DifferentialAddCommentView.php
+++ b/src/applications/differential/view/DifferentialAddCommentView.php
@@ -50,6 +50,7 @@
}
public function render() {
+ $viewer = $this->getViewer();
$this->requireResource('differential-revision-add-comment-css');
$revision = $this->revision;
@@ -73,7 +74,7 @@
$form = new AphrontFormView();
$form
->setWorkflow(true)
- ->setUser($this->user)
+ ->setViewer($viewer)
->setAction($this->actionURI)
->addHiddenInput('revision_id', $revision->getID())
->appendChild(
@@ -108,7 +109,7 @@
->setID('comment-content')
->setLabel(pht('Comment'))
->setValue($this->draft ? $this->draft->getDraft() : null)
- ->setUser($this->user))
+ ->setViewer($viewer))
->appendChild(
id(new AphrontFormSubmitControl())
->setValue(pht('Submit')));
diff --git a/src/applications/differential/view/DifferentialChangesetListView.php b/src/applications/differential/view/DifferentialChangesetListView.php
--- a/src/applications/differential/view/DifferentialChangesetListView.php
+++ b/src/applications/differential/view/DifferentialChangesetListView.php
@@ -113,6 +113,8 @@
}
public function render() {
+ $viewer = $this->getViewer();
+
$this->requireResource('differential-changeset-view-css');
$changesets = $this->changesets;
@@ -148,7 +150,7 @@
));
$renderer = DifferentialChangesetParser::getDefaultRendererForViewer(
- $this->getUser());
+ $viewer);
$output = array();
$ids = array();
@@ -163,7 +165,7 @@
$ref = $this->references[$key];
$detail = id(new DifferentialChangesetDetailView())
- ->setUser($this->getUser());
+ ->setUser($viewer);
$uniq_id = 'diff-'.$changeset->getAnchorName();
$detail->setID($uniq_id);
@@ -261,6 +263,7 @@
DifferentialChangesetDetailView $detail,
$ref,
DifferentialChangeset $changeset) {
+ $viewer = $this->getViewer();
$meta = array();
@@ -280,7 +283,7 @@
try {
$meta['diffusionURI'] =
(string)$repository->getDiffusionBrowseURIForPath(
- $this->user,
+ $viewer,
$changeset->getAbsoluteRepositoryPath($repository, $this->diff),
idx($changeset->getMetadata(), 'line:first'),
$this->getBranch());
@@ -308,13 +311,12 @@
}
}
- $user = $this->user;
- if ($user && $repository) {
+ if ($viewer && $repository) {
$path = ltrim(
$changeset->getAbsoluteRepositoryPath($repository, $this->diff),
'/');
$line = idx($changeset->getMetadata(), 'line:first', 1);
- $editor_link = $user->loadEditorLink($path, $line, $repository);
+ $editor_link = $viewer->loadEditorLink($path, $line, $repository);
if ($editor_link) {
$meta['editor'] = $editor_link;
} else {
diff --git a/src/applications/differential/view/DifferentialLocalCommitsView.php b/src/applications/differential/view/DifferentialLocalCommitsView.php
--- a/src/applications/differential/view/DifferentialLocalCommitsView.php
+++ b/src/applications/differential/view/DifferentialLocalCommitsView.php
@@ -17,10 +17,7 @@
}
public function render() {
- $user = $this->user;
- if (!$user) {
- throw new PhutilInvalidStateException('setUser');
- }
+ $viewer = $this->getViewer();
$local = $this->localCommits;
if (!$local) {
@@ -94,7 +91,7 @@
idx($commit, 'date'),
idx($commit, 'time'));
if ($date) {
- $date = phabricator_datetime($date, $user);
+ $date = phabricator_datetime($date, $viewer);
}
$row[] = $date;
diff --git a/src/applications/differential/view/DifferentialRevisionListView.php b/src/applications/differential/view/DifferentialRevisionListView.php
--- a/src/applications/differential/view/DifferentialRevisionListView.php
+++ b/src/applications/differential/view/DifferentialRevisionListView.php
@@ -57,10 +57,7 @@
}
public function render() {
- $user = $this->user;
- if (!$user) {
- throw new PhutilInvalidStateException('setUser');
- }
+ $viewer = $this->getViewer();
$fresh = PhabricatorEnv::getEnvConfig('differential.days-fresh');
if ($fresh) {
@@ -83,12 +80,12 @@
foreach ($this->revisions as $revision) {
$item = id(new PHUIObjectItemView())
- ->setUser($user);
+ ->setUser($viewer);
$icons = array();
$phid = $revision->getPHID();
- $flag = $revision->getFlag($user);
+ $flag = $revision->getFlag($viewer);
if ($flag) {
$flag_class = PhabricatorFlagColor::getCSSClass($flag->getColor());
$icons['flag'] = phutil_tag(
@@ -99,7 +96,7 @@
'');
}
- if ($revision->getDrafts($user)) {
+ if ($revision->getDrafts($viewer)) {
$icons['draft'] = true;
}
diff --git a/src/applications/diffusion/view/DiffusionTagListView.php b/src/applications/diffusion/view/DiffusionTagListView.php
--- a/src/applications/diffusion/view/DiffusionTagListView.php
+++ b/src/applications/diffusion/view/DiffusionTagListView.php
@@ -100,7 +100,7 @@
$build,
$author,
$description,
- phabricator_datetime($tag->getEpoch(), $this->user),
+ phabricator_datetime($tag->getEpoch(), $this->getViewer()),
);
}
diff --git a/src/applications/phame/view/PhameBlogListView.php b/src/applications/phame/view/PhameBlogListView.php
--- a/src/applications/phame/view/PhameBlogListView.php
+++ b/src/applications/phame/view/PhameBlogListView.php
@@ -3,7 +3,6 @@
final class PhameBlogListView extends AphrontTagView {
private $blogs;
- private $viewer;
public function setBlogs($blogs) {
assert_instances_of($blogs, 'PhameBlog');
@@ -11,11 +10,6 @@
return $this;
}
- public function setViewer($viewer) {
- $this->viewer = $viewer;
- return $this;
- }
-
protected function getTagAttributes() {
$classes = array();
$classes[] = 'phame-blog-list';
diff --git a/src/applications/phame/view/PhameDraftListView.php b/src/applications/phame/view/PhameDraftListView.php
--- a/src/applications/phame/view/PhameDraftListView.php
+++ b/src/applications/phame/view/PhameDraftListView.php
@@ -4,7 +4,6 @@
private $posts;
private $blogs;
- private $viewer;
public function setPosts($posts) {
assert_instances_of($posts, 'PhamePost');
@@ -18,11 +17,6 @@
return $this;
}
- public function setViewer($viewer) {
- $this->viewer = $viewer;
- return $this;
- }
-
protected function getTagAttributes() {
$classes = array();
$classes[] = 'phame-blog-list';
diff --git a/src/applications/phame/view/PhamePostListView.php b/src/applications/phame/view/PhamePostListView.php
--- a/src/applications/phame/view/PhamePostListView.php
+++ b/src/applications/phame/view/PhamePostListView.php
@@ -4,7 +4,6 @@
private $posts;
private $nodata;
- private $viewer;
private $showBlog = false;
private $isExternal;
private $isLive;
@@ -25,11 +24,6 @@
return $this;
}
- public function setViewer($viewer) {
- $this->viewer = $viewer;
- return $this;
- }
-
public function setIsExternal($is_external) {
$this->isExternal = $is_external;
return $this;
@@ -53,7 +47,7 @@
}
protected function getTagContent() {
- $viewer = $this->viewer;
+ $viewer = $this->getViewer();
$posts = $this->posts;
$nodata = $this->nodata;
diff --git a/src/applications/ponder/view/PonderAddAnswerView.php b/src/applications/ponder/view/PonderAddAnswerView.php
--- a/src/applications/ponder/view/PonderAddAnswerView.php
+++ b/src/applications/ponder/view/PonderAddAnswerView.php
@@ -18,7 +18,7 @@
public function render() {
$question = $this->question;
- $viewer = $this->user;
+ $viewer = $this->getViewer();
$authors = mpull($question->getAnswers(), null, 'getAuthorPHID');
if (isset($authors[$viewer->getPHID()])) {
@@ -49,7 +49,7 @@
$form = new AphrontFormView();
$form
- ->setUser($this->user)
+ ->setViewer($viewer)
->setAction($this->actionURI)
->setWorkflow(true)
->addHiddenInput('question_id', $question->getID())
@@ -59,7 +59,7 @@
->setLabel(pht('Answer'))
->setError(true)
->setID('answer-content')
- ->setUser($this->user))
+ ->setViewer($viewer))
->appendChild(
id(new AphrontFormSubmitControl())
->setValue(pht('Add Answer')));
diff --git a/src/applications/project/view/PhabricatorProjectUserListView.php b/src/applications/project/view/PhabricatorProjectUserListView.php
--- a/src/applications/project/view/PhabricatorProjectUserListView.php
+++ b/src/applications/project/view/PhabricatorProjectUserListView.php
@@ -45,7 +45,7 @@
abstract protected function getHeaderText();
public function render() {
- $viewer = $this->getUser();
+ $viewer = $this->getViewer();
$project = $this->getProject();
$user_phids = $this->getUserPHIDs();
diff --git a/src/infrastructure/diff/view/PHUIDiffInlineCommentEditView.php b/src/infrastructure/diff/view/PHUIDiffInlineCommentEditView.php
--- a/src/infrastructure/diff/view/PHUIDiffInlineCommentEditView.php
+++ b/src/infrastructure/diff/view/PHUIDiffInlineCommentEditView.php
@@ -78,12 +78,11 @@
if (!$this->uri) {
throw new PhutilInvalidStateException('setSubmitURI');
}
- if (!$this->user) {
- throw new PhutilInvalidStateException('setUser');
- }
+
+ $viewer = $this->getViewer();
$content = phabricator_form(
- $this->user,
+ $viewer,
array(
'action' => $this->uri,
'method' => 'POST',
diff --git a/src/view/AphrontDialogView.php b/src/view/AphrontDialogView.php
--- a/src/view/AphrontDialogView.php
+++ b/src/view/AphrontDialogView.php
@@ -236,11 +236,11 @@
$this->cancelText);
}
- if (!$this->user) {
+ if (!$this->hasViewer()) {
throw new Exception(
pht(
'You must call %s when rendering an %s.',
- 'setUser()',
+ 'setViewer()',
__CLASS__));
}
@@ -308,7 +308,7 @@
if (!$this->renderAsForm) {
$buttons = array(
phabricator_form(
- $this->user,
+ $this->getViewer(),
$form_attributes,
array_merge($hidden_inputs, $buttons)),
);
@@ -376,7 +376,7 @@
if ($this->renderAsForm) {
return phabricator_form(
- $this->user,
+ $this->getViewer(),
$form_attributes + $attributes,
array($hidden_inputs, $content));
} else {
diff --git a/src/view/AphrontView.php b/src/view/AphrontView.php
--- a/src/view/AphrontView.php
+++ b/src/view/AphrontView.php
@@ -6,7 +6,7 @@
abstract class AphrontView extends Phobject
implements PhutilSafeHTMLProducerInterface {
- protected $user;
+ private $viewer;
protected $children = array();
@@ -14,19 +14,65 @@
/**
+ * Set the user viewing this element.
+ *
+ * @param PhabricatorUser Viewing user.
+ * @return this
+ */
+ public function setViewer(PhabricatorUser $viewer) {
+ $this->viewer = $viewer;
+ return $this;
+ }
+
+
+ /**
+ * Get the user viewing this element.
+ *
+ * Throws an exception if no viewer has been set.
+ *
+ * @return PhabricatorUser Viewing user.
+ */
+ public function getViewer() {
+ if (!$this->viewer) {
+ throw new PhutilInvalidStateException('setViewer');
+ }
+
+ return $this->viewer;
+ }
+
+
+ /**
+ * Test if a viewer has been set on this elmeent.
+ *
+ * @return bool True if a viewer is available.
+ */
+ public function hasViewer() {
+ return (bool)$this->viewer;
+ }
+
+
+ /**
+ * Deprecated, use @{method:setViewer}.
+ *
* @task config
+ * @deprecated
*/
public function setUser(PhabricatorUser $user) {
- $this->user = $user;
- return $this;
+ return $this->setViewer($user);
}
/**
+ * Deprecated, use @{method:getViewer}.
+ *
* @task config
+ * @deprecated
*/
protected function getUser() {
- return $this->user;
+ if (!$this->hasViewer()) {
+ return null;
+ }
+ return $this->getViewer();
}
diff --git a/src/view/form/AphrontFormView.php b/src/view/form/AphrontFormView.php
--- a/src/view/form/AphrontFormView.php
+++ b/src/view/form/AphrontFormView.php
@@ -85,13 +85,13 @@
public function appendRemarkupInstructions($remarkup) {
return $this->appendInstructions(
- new PHUIRemarkupView($this->getUser(), $remarkup));
+ new PHUIRemarkupView($this->getViewer(), $remarkup));
}
public function buildLayoutView() {
foreach ($this->controls as $control) {
- $control->setUser($this->getUser());
+ $control->setViewer($this->getViewer());
$control->willRender();
}
@@ -123,7 +123,7 @@
$layout = $this->buildLayoutView();
- if (!$this->user) {
+ if (!$this->hasViewer()) {
throw new Exception(
pht(
'You must pass the user to %s.',
@@ -136,7 +136,7 @@
}
return phabricator_form(
- $this->user,
+ $this->getViewer(),
array(
'class' => $this->shaded ? 'phui-form-shaded' : null,
'action' => $this->action,
diff --git a/src/view/form/control/AphrontFormDateControl.php b/src/view/form/control/AphrontFormDateControl.php
--- a/src/view/form/control/AphrontFormDateControl.php
+++ b/src/view/form/control/AphrontFormDateControl.php
@@ -137,12 +137,12 @@
}
private function getTimeFormat() {
- return $this->getUser()
+ return $this->getViewer()
->getPreference(PhabricatorUserPreferences::PREFERENCE_TIME_FORMAT);
}
private function getDateFormat() {
- return $this->getUser()
+ return $this->getViewer()
->getPreference(PhabricatorUserPreferences::PREFERENCE_DATE_FORMAT);
}
@@ -153,7 +153,7 @@
private function formatTime($epoch, $fmt) {
return phabricator_format_local_time(
$epoch,
- $this->user,
+ $this->getViewer(),
$fmt);
}
@@ -259,7 +259,7 @@
),
$time_sel);
- $preferences = $this->user->loadPreferences();
+ $preferences = $this->getViewer()->loadPreferences();
$pref_week_start = PhabricatorUserPreferences::PREFERENCE_WEEK_START_DAY;
$week_start = $preferences->getPreference($pref_week_start, 0);
@@ -300,12 +300,9 @@
return $this->zone;
}
- $user = $this->getUser();
- if (!$this->getUser()) {
- throw new PhutilInvalidStateException('setUser');
- }
+ $viewer = $this->getViewer();
- $user_zone = $user->getTimezoneIdentifier();
+ $user_zone = $viewer->getTimezoneIdentifier();
$this->zone = new DateTimeZone($user_zone);
return $this->zone;
}
diff --git a/src/view/form/control/AphrontFormTokenizerControl.php b/src/view/form/control/AphrontFormTokenizerControl.php
--- a/src/view/form/control/AphrontFormTokenizerControl.php
+++ b/src/view/form/control/AphrontFormTokenizerControl.php
@@ -90,8 +90,8 @@
}
$username = null;
- if ($this->user) {
- $username = $this->user->getUsername();
+ if ($this->hasViewer()) {
+ $username = $this->getViewer()->getUsername();
}
$datasource_uri = $datasource->getDatasourceURI();
diff --git a/src/view/layout/AphrontSideNavFilterView.php b/src/view/layout/AphrontSideNavFilterView.php
--- a/src/view/layout/AphrontSideNavFilterView.php
+++ b/src/view/layout/AphrontSideNavFilterView.php
@@ -199,9 +199,6 @@
}
private function renderFlexNav() {
-
- $user = $this->user;
-
require_celerity_resource('phabricator-nav-view-css');
$nav_classes = array();
diff --git a/src/view/layout/PhabricatorActionListView.php b/src/view/layout/PhabricatorActionListView.php
--- a/src/view/layout/PhabricatorActionListView.php
+++ b/src/view/layout/PhabricatorActionListView.php
@@ -22,9 +22,7 @@
}
public function render() {
- if (!$this->user) {
- throw new PhutilInvalidStateException('setUser');
- }
+ $viewer = $this->getViewer();
$event = new PhabricatorEvent(
PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS,
@@ -32,7 +30,7 @@
'object' => $this->object,
'actions' => $this->actions,
));
- $event->setUser($this->user);
+ $event->setUser($viewer);
PhutilEventEngine::dispatchEvent($event);
$actions = $event->getValue('actions');
@@ -41,7 +39,7 @@
}
foreach ($actions as $action) {
- $action->setUser($this->user);
+ $action->setViewer($viewer);
}
require_celerity_resource('phabricator-action-list-view-css');
diff --git a/src/view/layout/PhabricatorActionView.php b/src/view/layout/PhabricatorActionView.php
--- a/src/view/layout/PhabricatorActionView.php
+++ b/src/view/layout/PhabricatorActionView.php
@@ -125,11 +125,11 @@
$sigils = $sigils ? implode(' ', $sigils) : null;
if ($this->renderAsForm) {
- if (!$this->user) {
+ if (!$this->hasViewer()) {
throw new Exception(
pht(
'Call %s when rendering an action as a form.',
- 'setUser()'));
+ 'setViewer()'));
}
$item = javelin_tag(
@@ -140,7 +140,7 @@
array($icon, $this->name));
$item = phabricator_form(
- $this->user,
+ $this->getViewer(),
array(
'action' => $this->getHref(),
'method' => 'POST',
diff --git a/src/view/page/menu/PhabricatorMainMenuSearchView.php b/src/view/page/menu/PhabricatorMainMenuSearchView.php
--- a/src/view/page/menu/PhabricatorMainMenuSearchView.php
+++ b/src/view/page/menu/PhabricatorMainMenuSearchView.php
@@ -24,7 +24,7 @@
}
public function render() {
- $user = $this->user;
+ $viewer = $this->getViewer();
$target_id = celerity_generate_unique_node_id();
$search_id = $this->getID();
@@ -86,7 +86,7 @@
$selector = $this->buildModeSelector($selector_id, $application_id);
$form = phabricator_form(
- $user,
+ $viewer,
array(
'action' => '/search/',
'method' => 'POST',
@@ -109,7 +109,7 @@
}
private function buildModeSelector($selector_id, $application_id) {
- $viewer = $this->getUser();
+ $viewer = $this->getViewer();
$items = array();
$items[] = array(
diff --git a/src/view/page/menu/PhabricatorMainMenuView.php b/src/view/page/menu/PhabricatorMainMenuView.php
--- a/src/view/page/menu/PhabricatorMainMenuView.php
+++ b/src/view/page/menu/PhabricatorMainMenuView.php
@@ -24,7 +24,7 @@
}
public function render() {
- $user = $this->user;
+ $viewer = $this->getViewer();
require_celerity_resource('phabricator-main-menu-view');
@@ -35,7 +35,7 @@
$app_button = '';
$aural = null;
- if ($user->isLoggedIn() && $user->isUserActivated()) {
+ if ($viewer->isLoggedIn() && $viewer->isUserActivated()) {
list($menu, $dropdowns, $aural) = $this->renderNotificationMenu();
if (array_filter($menu)) {
$alerts[] = $menu;
@@ -77,10 +77,10 @@
$controller = $this->getController();
foreach ($applications as $application) {
$app_actions = $application->buildMainMenuItems(
- $user,
+ $viewer,
$controller);
$app_extra = $application->buildMainMenuExtraNodes(
- $user,
+ $viewer,
$controller);
foreach ($app_actions as $action) {
@@ -97,7 +97,7 @@
$extensions = PhabricatorMainMenuBarExtension::getAllEnabledExtensions();
foreach ($extensions as $extension) {
- $extension->setViewer($user);
+ $extension->setViewer($viewer);
$controller = $this->getController();
if ($controller) {
@@ -158,7 +158,7 @@
}
private function renderSearch() {
- $user = $this->user;
+ $viewer = $this->getViewer();
$result = null;
@@ -166,15 +166,15 @@
'helpURI' => '/help/keyboardshortcut/',
);
- if ($user->isLoggedIn()) {
- $show_search = $user->isUserActivated();
+ if ($viewer->isLoggedIn()) {
+ $show_search = $viewer->isUserActivated();
} else {
$show_search = PhabricatorEnv::getEnvConfig('policy.allow-public');
}
if ($show_search) {
$search = new PhabricatorMainMenuSearchView();
- $search->setUser($user);
+ $search->setViewer($viewer);
$application = null;
$controller = $this->getController();
@@ -188,7 +188,7 @@
$result = $search;
$pref_shortcut = PhabricatorUserPreferences::PREFERENCE_SEARCH_SHORTCUT;
- if ($user->loadPreferences()->getPreference($pref_shortcut, true)) {
+ if ($viewer->loadPreferences()->getPreference($pref_shortcut, true)) {
$keyboard_config['searchID'] = $search->getID();
}
}
@@ -230,7 +230,7 @@
}
private function renderApplicationMenu(array $bar_items) {
- $user = $this->getUser();
+ $viewer = $this->getViewer();
$view = $this->getApplicationMenu();
@@ -302,7 +302,7 @@
$logo_uri = $cache->getKey($cache_key_logo);
if (!$logo_uri) {
$file = id(new PhabricatorFileQuery())
- ->setViewer($this->getUser())
+ ->setViewer($this->getViewer())
->withPHIDs(array($custom_header))
->executeOne();
if ($file) {
@@ -355,7 +355,7 @@
}
private function renderNotificationMenu() {
- $user = $this->user;
+ $viewer = $this->getViewer();
require_celerity_resource('phabricator-notification-css');
require_celerity_resource('phabricator-notification-menu-css');
@@ -364,7 +364,7 @@
$aural = array();
$dropdown_query = id(new AphlictDropdownDataQuery())
- ->setViewer($user);
+ ->setViewer($viewer);
$dropdown_data = $dropdown_query->execute();
$message_tag = '';
diff --git a/src/view/phui/PHUIFeedStoryView.php b/src/view/phui/PHUIFeedStoryView.php
--- a/src/view/phui/PHUIFeedStoryView.php
+++ b/src/view/phui/PHUIFeedStoryView.php
@@ -172,8 +172,8 @@
if ($this->epoch) {
// TODO: This is really bad; when rendering through Conduit and via
// renderText() we don't have a user.
- if ($this->user) {
- $foot = phabricator_datetime($this->epoch, $this->user);
+ if ($this->hasViewer()) {
+ $foot = phabricator_datetime($this->epoch, $this->getViewer());
} else {
$foot = null;
}
diff --git a/src/view/phui/calendar/PHUICalendarDayView.php b/src/view/phui/calendar/PHUICalendarDayView.php
--- a/src/view/phui/calendar/PHUICalendarDayView.php
+++ b/src/view/phui/calendar/PHUICalendarDayView.php
@@ -278,7 +278,7 @@
->addClass('calendar-day-view-sidebar');
$list = id(new PHUICalendarListView())
- ->setUser($this->user)
+ ->setUser($this->getViewer())
->setView('day');
if (count($events) == 0) {
@@ -304,7 +304,7 @@
$box_start_time = clone $display_start_day;
- $today_time = PhabricatorTime::getTodayMidnightDateTime($this->user);
+ $today_time = PhabricatorTime::getTodayMidnightDateTime($this->getViewer());
$tomorrow_time = clone $today_time;
$tomorrow_time->modify('+1 day');
@@ -437,7 +437,7 @@
}
private function getDateTime() {
- $user = $this->user;
+ $user = $this->getViewer();
$timezone = new DateTimeZone($user->getTimezoneIdentifier());
$day = $this->day;
diff --git a/src/view/phui/calendar/PHUICalendarMonthView.php b/src/view/phui/calendar/PHUICalendarMonthView.php
--- a/src/view/phui/calendar/PHUICalendarMonthView.php
+++ b/src/view/phui/calendar/PHUICalendarMonthView.php
@@ -51,9 +51,7 @@
}
public function render() {
- if (empty($this->user)) {
- throw new PhutilInvalidStateException('setUser');
- }
+ $viewer = $this->getViewer();
$events = msort($this->events, 'getEpochStart');
$days = $this->getDatesInMonth();
@@ -93,7 +91,7 @@
$counter = 0;
$list = new PHUICalendarListView();
- $list->setUser($this->user);
+ $list->setViewer($viewer);
foreach ($all_day_events as $item) {
if ($counter <= $max_daily) {
$list->addEvent($item);
@@ -495,9 +493,9 @@
* @return list List of DateTimes, one for each day.
*/
private function getDatesInMonth() {
- $user = $this->user;
+ $viewer = $this->getViewer();
- $timezone = new DateTimeZone($user->getTimezoneIdentifier());
+ $timezone = new DateTimeZone($viewer->getTimezoneIdentifier());
$month = $this->month;
$year = $this->year;
@@ -575,7 +573,7 @@
}
private function getWeekStartAndEnd() {
- $preferences = $this->user->loadPreferences();
+ $preferences = $this->getViewer()->loadPreferences();
$pref_week_start = PhabricatorUserPreferences::PREFERENCE_WEEK_START_DAY;
$week_start = $preferences->getPreference($pref_week_start, 0);
@@ -585,7 +583,7 @@
}
private function getDateTime() {
- $user = $this->user;
+ $user = $this->getViewer();
$timezone = new DateTimeZone($user->getTimezoneIdentifier());
$month = $this->month;

File Metadata

Mime Type
text/plain
Expires
Tue, Mar 25, 6:05 PM (1 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7703494
Default Alt Text
D15412.id37161.diff (27 KB)

Event Timeline