Differential D18457 Diff 44343 src/applications/notification/builder/PhabricatorNotificationBuilder.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/notification/builder/PhabricatorNotificationBuilder.php
| Show First 20 Lines • Show All 139 Lines • ▼ Show 20 Lines | public function buildView() { | ||||
| return $null_view; | return $null_view; | ||||
| } | } | ||||
| public function buildDict() { | public function buildDict() { | ||||
| $stories = $this->parseStories(); | $stories = $this->parseStories(); | ||||
| $dict = array(); | $dict = array(); | ||||
| $viewer = $this->user; | $viewer = $this->user; | ||||
| $desktop_key = PhabricatorDesktopNotificationsSetting::SETTINGKEY; | $key = PhabricatorNotificationsSetting::SETTINGKEY; | ||||
| $desktop_enabled = $viewer->getUserSetting($desktop_key); | $setting = $viewer->getUserSetting($key); | ||||
| $desktop_ready = PhabricatorNotificationsSetting::desktopReady($setting); | |||||
| $web_ready = PhabricatorNotificationsSetting::webReady($setting); | |||||
| foreach ($stories as $story) { | foreach ($stories as $story) { | ||||
| if ($story instanceof PhabricatorApplicationTransactionFeedStory) { | if ($story instanceof PhabricatorApplicationTransactionFeedStory) { | ||||
| $dict[] = array( | $dict[] = array( | ||||
| 'desktopReady' => $desktop_enabled, | 'desktopReady' => $desktop_ready, | ||||
| 'webReady' => $web_ready, | |||||
| 'title' => $story->renderText(), | 'title' => $story->renderText(), | ||||
| 'body' => $story->renderTextBody(), | 'body' => $story->renderTextBody(), | ||||
| 'href' => $story->getURI(), | 'href' => $story->getURI(), | ||||
| 'icon' => $story->getImageURI(), | 'icon' => $story->getImageURI(), | ||||
| ); | ); | ||||
| } else if ($story instanceof PhabricatorNotificationTestFeedStory) { | } else if ($story instanceof PhabricatorNotificationTestFeedStory) { | ||||
| $dict[] = array( | $dict[] = array( | ||||
| 'desktopReady' => $desktop_enabled, | 'desktopReady' => $desktop_ready, | ||||
| 'webReady' => $web_ready, | |||||
| 'title' => pht('Test Notification'), | 'title' => pht('Test Notification'), | ||||
| 'body' => $story->renderText(), | 'body' => $story->renderText(), | ||||
| 'href' => null, | 'href' => null, | ||||
| 'icon' => PhabricatorUser::getDefaultProfileImageURI(), | 'icon' => PhabricatorUser::getDefaultProfileImageURI(), | ||||
| ); | ); | ||||
| } else { | } else { | ||||
| $dict[] = array( | $dict[] = array( | ||||
| 'desktopReady' => false, | 'desktopReady' => false, | ||||
| 'webReady' => false, | |||||
| 'title' => null, | 'title' => null, | ||||
| 'body' => null, | 'body' => null, | ||||
| 'href' => null, | 'href' => null, | ||||
| 'icon' => null, | 'icon' => null, | ||||
| ); | ); | ||||
| } | } | ||||
| } | } | ||||
| return $dict; | return $dict; | ||||
| } | } | ||||
| } | } | ||||