1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-18 12:52:42 +01:00

Give AphrontTagView a getViewer(), deprecate getUser()

Summary:
Two minor changes here:

  - Replace `get/setUser()` with `get/setViewer()` for consistency with everything else.
  - `getViewer()` now throws if no viewer is set. We had a lot of code that either "should" check this but didn't, or did check it in an identical way, duplicating work. In contrast, very little code checks for a viewer but works if one is not present.

Test Plan:
  - Grepped for `->user`.
  - Attempted to fix all callsites inside `*View` classes.
  - Browsed around a bunch of applications, particularly Calendar, Differential and Diffusion, which seemed most heavily affected.

Reviewers: chad

Reviewed By: chad

Differential Revision: https://secure.phabricator.com/D15412
This commit is contained in:
epriestley 2016-03-06 06:26:34 -08:00
parent abb4c03b47
commit aaab1011e5
27 changed files with 134 additions and 126 deletions

View file

@ -16,8 +16,7 @@ final class PhabricatorBadgesRecipientsListView extends AphrontView {
}
public function render() {
$viewer = $this->user;
$viewer = $this->getViewer();
$badge = $this->badge;
$handles = $this->handles;

View file

@ -24,12 +24,9 @@ final class PhabricatorDaemonLogEventsView extends AphrontView {
}
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 @@ final class PhabricatorDaemonLogEventsView extends AphrontView {
$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,

View file

@ -11,11 +11,9 @@ final class PhabricatorDaemonLogListView extends AphrontView {
}
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 @@ final class PhabricatorDaemonLogListView extends AphrontView {
->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) {

View file

@ -50,6 +50,7 @@ final class DifferentialAddCommentView extends AphrontView {
}
public function render() {
$viewer = $this->getViewer();
$this->requireResource('differential-revision-add-comment-css');
$revision = $this->revision;
@ -73,7 +74,7 @@ final class DifferentialAddCommentView extends AphrontView {
$form = new AphrontFormView();
$form
->setWorkflow(true)
->setUser($this->user)
->setViewer($viewer)
->setAction($this->actionURI)
->addHiddenInput('revision_id', $revision->getID())
->appendChild(
@ -108,7 +109,7 @@ final class DifferentialAddCommentView extends AphrontView {
->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')));

View file

@ -113,6 +113,8 @@ final class DifferentialChangesetListView extends AphrontView {
}
public function render() {
$viewer = $this->getViewer();
$this->requireResource('differential-changeset-view-css');
$changesets = $this->changesets;
@ -148,7 +150,7 @@ final class DifferentialChangesetListView extends AphrontView {
));
$renderer = DifferentialChangesetParser::getDefaultRendererForViewer(
$this->getUser());
$viewer);
$output = array();
$ids = array();
@ -163,7 +165,7 @@ final class DifferentialChangesetListView extends AphrontView {
$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 @@ final class DifferentialChangesetListView extends AphrontView {
DifferentialChangesetDetailView $detail,
$ref,
DifferentialChangeset $changeset) {
$viewer = $this->getViewer();
$meta = array();
@ -280,7 +283,7 @@ final class DifferentialChangesetListView extends AphrontView {
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 @@ final class DifferentialChangesetListView extends AphrontView {
}
}
$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 {

View file

@ -17,10 +17,7 @@ final class DifferentialLocalCommitsView extends AphrontView {
}
public function render() {
$user = $this->user;
if (!$user) {
throw new PhutilInvalidStateException('setUser');
}
$viewer = $this->getViewer();
$local = $this->localCommits;
if (!$local) {
@ -94,7 +91,7 @@ final class DifferentialLocalCommitsView extends AphrontView {
idx($commit, 'date'),
idx($commit, 'time'));
if ($date) {
$date = phabricator_datetime($date, $user);
$date = phabricator_datetime($date, $viewer);
}
$row[] = $date;

View file

@ -57,10 +57,7 @@ final class DifferentialRevisionListView extends AphrontView {
}
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 @@ final class DifferentialRevisionListView extends AphrontView {
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 @@ final class DifferentialRevisionListView extends AphrontView {
'');
}
if ($revision->getDrafts($user)) {
if ($revision->getDrafts($viewer)) {
$icons['draft'] = true;
}

View file

@ -100,7 +100,7 @@ final class DiffusionTagListView extends DiffusionView {
$build,
$author,
$description,
phabricator_datetime($tag->getEpoch(), $this->user),
phabricator_datetime($tag->getEpoch(), $this->getViewer()),
);
}

View file

@ -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 @@ final class PhameBlogListView extends AphrontTagView {
return $this;
}
public function setViewer($viewer) {
$this->viewer = $viewer;
return $this;
}
protected function getTagAttributes() {
$classes = array();
$classes[] = 'phame-blog-list';

View file

@ -4,7 +4,6 @@ final class PhameDraftListView extends AphrontTagView {
private $posts;
private $blogs;
private $viewer;
public function setPosts($posts) {
assert_instances_of($posts, 'PhamePost');
@ -18,11 +17,6 @@ final class PhameDraftListView extends AphrontTagView {
return $this;
}
public function setViewer($viewer) {
$this->viewer = $viewer;
return $this;
}
protected function getTagAttributes() {
$classes = array();
$classes[] = 'phame-blog-list';

View file

@ -4,7 +4,6 @@ final class PhamePostListView extends AphrontTagView {
private $posts;
private $nodata;
private $viewer;
private $showBlog = false;
private $isExternal;
private $isLive;
@ -25,11 +24,6 @@ final class PhamePostListView extends AphrontTagView {
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 @@ final class PhamePostListView extends AphrontTagView {
}
protected function getTagContent() {
$viewer = $this->viewer;
$viewer = $this->getViewer();
$posts = $this->posts;
$nodata = $this->nodata;

View file

@ -18,7 +18,7 @@ final class PonderAddAnswerView extends AphrontView {
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 @@ final class PonderAddAnswerView extends AphrontView {
$form = new AphrontFormView();
$form
->setUser($this->user)
->setViewer($viewer)
->setAction($this->actionURI)
->setWorkflow(true)
->addHiddenInput('question_id', $question->getID())
@ -59,7 +59,7 @@ final class PonderAddAnswerView extends AphrontView {
->setLabel(pht('Answer'))
->setError(true)
->setID('answer-content')
->setUser($this->user))
->setViewer($viewer))
->appendChild(
id(new AphrontFormSubmitControl())
->setValue(pht('Add Answer')));

View file

@ -45,7 +45,7 @@ abstract class PhabricatorProjectUserListView extends AphrontView {
abstract protected function getHeaderText();
public function render() {
$viewer = $this->getUser();
$viewer = $this->getViewer();
$project = $this->getProject();
$user_phids = $this->getUserPHIDs();

View file

@ -78,12 +78,11 @@ final class PHUIDiffInlineCommentEditView
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',

View file

@ -236,11 +236,11 @@ final class AphrontDialogView
$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 @@ final class AphrontDialogView
if (!$this->renderAsForm) {
$buttons = array(
phabricator_form(
$this->user,
$this->getViewer(),
$form_attributes,
array_merge($hidden_inputs, $buttons)),
);
@ -376,7 +376,7 @@ final class AphrontDialogView
if ($this->renderAsForm) {
return phabricator_form(
$this->user,
$this->getViewer(),
$form_attributes + $attributes,
array($hidden_inputs, $content));
} else {

View file

@ -6,7 +6,7 @@
abstract class AphrontView extends Phobject
implements PhutilSafeHTMLProducerInterface {
protected $user;
private $viewer;
protected $children = array();
@ -14,19 +14,65 @@ abstract class AphrontView extends Phobject
/**
* @task config
* Set the user viewing this element.
*
* @param PhabricatorUser Viewing user.
* @return this
*/
public function setUser(PhabricatorUser $user) {
$this->user = $user;
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) {
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();
}

View file

@ -85,13 +85,13 @@ final class AphrontFormView extends AphrontView {
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 @@ final class AphrontFormView extends AphrontView {
$layout = $this->buildLayoutView();
if (!$this->user) {
if (!$this->hasViewer()) {
throw new Exception(
pht(
'You must pass the user to %s.',
@ -136,7 +136,7 @@ final class AphrontFormView extends AphrontView {
}
return phabricator_form(
$this->user,
$this->getViewer(),
array(
'class' => $this->shaded ? 'phui-form-shaded' : null,
'action' => $this->action,

View file

@ -137,12 +137,12 @@ final class AphrontFormDateControl extends AphrontFormControl {
}
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 @@ final class AphrontFormDateControl extends AphrontFormControl {
private function formatTime($epoch, $fmt) {
return phabricator_format_local_time(
$epoch,
$this->user,
$this->getViewer(),
$fmt);
}
@ -259,7 +259,7 @@ final class AphrontFormDateControl extends AphrontFormControl {
),
$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 @@ final class AphrontFormDateControl extends AphrontFormControl {
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;
}

View file

@ -90,8 +90,8 @@ final class AphrontFormTokenizerControl extends AphrontFormControl {
}
$username = null;
if ($this->user) {
$username = $this->user->getUsername();
if ($this->hasViewer()) {
$username = $this->getViewer()->getUsername();
}
$datasource_uri = $datasource->getDatasourceURI();

View file

@ -199,9 +199,6 @@ final class AphrontSideNavFilterView extends AphrontView {
}
private function renderFlexNav() {
$user = $this->user;
require_celerity_resource('phabricator-nav-view-css');
$nav_classes = array();

View file

@ -22,9 +22,7 @@ final class PhabricatorActionListView extends AphrontView {
}
public function render() {
if (!$this->user) {
throw new PhutilInvalidStateException('setUser');
}
$viewer = $this->getViewer();
$event = new PhabricatorEvent(
PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS,
@ -32,7 +30,7 @@ final class PhabricatorActionListView extends AphrontView {
'object' => $this->object,
'actions' => $this->actions,
));
$event->setUser($this->user);
$event->setUser($viewer);
PhutilEventEngine::dispatchEvent($event);
$actions = $event->getValue('actions');
@ -41,7 +39,7 @@ final class PhabricatorActionListView extends AphrontView {
}
foreach ($actions as $action) {
$action->setUser($this->user);
$action->setViewer($viewer);
}
require_celerity_resource('phabricator-action-list-view-css');

View file

@ -125,11 +125,11 @@ final class PhabricatorActionView extends AphrontView {
$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 @@ final class PhabricatorActionView extends AphrontView {
array($icon, $this->name));
$item = phabricator_form(
$this->user,
$this->getViewer(),
array(
'action' => $this->getHref(),
'method' => 'POST',

View file

@ -24,7 +24,7 @@ final class PhabricatorMainMenuSearchView extends AphrontView {
}
public function render() {
$user = $this->user;
$viewer = $this->getViewer();
$target_id = celerity_generate_unique_node_id();
$search_id = $this->getID();
@ -86,7 +86,7 @@ final class PhabricatorMainMenuSearchView extends AphrontView {
$selector = $this->buildModeSelector($selector_id, $application_id);
$form = phabricator_form(
$user,
$viewer,
array(
'action' => '/search/',
'method' => 'POST',
@ -109,7 +109,7 @@ final class PhabricatorMainMenuSearchView extends AphrontView {
}
private function buildModeSelector($selector_id, $application_id) {
$viewer = $this->getUser();
$viewer = $this->getViewer();
$items = array();
$items[] = array(

View file

@ -24,7 +24,7 @@ final class PhabricatorMainMenuView extends AphrontView {
}
public function render() {
$user = $this->user;
$viewer = $this->getViewer();
require_celerity_resource('phabricator-main-menu-view');
@ -35,7 +35,7 @@ final class PhabricatorMainMenuView extends AphrontView {
$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 @@ final class PhabricatorMainMenuView extends AphrontView {
$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 @@ final class PhabricatorMainMenuView extends AphrontView {
$extensions = PhabricatorMainMenuBarExtension::getAllEnabledExtensions();
foreach ($extensions as $extension) {
$extension->setViewer($user);
$extension->setViewer($viewer);
$controller = $this->getController();
if ($controller) {
@ -158,7 +158,7 @@ final class PhabricatorMainMenuView extends AphrontView {
}
private function renderSearch() {
$user = $this->user;
$viewer = $this->getViewer();
$result = null;
@ -166,15 +166,15 @@ final class PhabricatorMainMenuView extends AphrontView {
'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 @@ final class PhabricatorMainMenuView extends AphrontView {
$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 @@ final class PhabricatorMainMenuView extends AphrontView {
}
private function renderApplicationMenu(array $bar_items) {
$user = $this->getUser();
$viewer = $this->getViewer();
$view = $this->getApplicationMenu();
@ -302,7 +302,7 @@ final class PhabricatorMainMenuView extends AphrontView {
$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 @@ final class PhabricatorMainMenuView extends AphrontView {
}
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 @@ final class PhabricatorMainMenuView extends AphrontView {
$aural = array();
$dropdown_query = id(new AphlictDropdownDataQuery())
->setViewer($user);
->setViewer($viewer);
$dropdown_data = $dropdown_query->execute();
$message_tag = '';

View file

@ -172,8 +172,8 @@ final class PHUIFeedStoryView extends AphrontView {
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;
}

View file

@ -278,7 +278,7 @@ final class PHUICalendarDayView extends AphrontView {
->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 @@ final class PHUICalendarDayView extends AphrontView {
$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 @@ final class PHUICalendarDayView extends AphrontView {
}
private function getDateTime() {
$user = $this->user;
$user = $this->getViewer();
$timezone = new DateTimeZone($user->getTimezoneIdentifier());
$day = $this->day;

View file

@ -51,9 +51,7 @@ final class PHUICalendarMonthView extends AphrontView {
}
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 @@ final class PHUICalendarMonthView extends AphrontView {
$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 @@ final class PHUICalendarMonthView extends AphrontView {
* @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 @@ final class PHUICalendarMonthView extends AphrontView {
}
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 @@ final class PHUICalendarMonthView extends AphrontView {
}
private function getDateTime() {
$user = $this->user;
$user = $this->getViewer();
$timezone = new DateTimeZone($user->getTimezoneIdentifier());
$month = $this->month;