Differential D18600 Diff 44661 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 147 Lines • ▼ Show 20 Lines | public function buildDict() { | ||||
| $key = PhabricatorNotificationsSetting::SETTINGKEY; | $key = PhabricatorNotificationsSetting::SETTINGKEY; | ||||
| $setting = $viewer->getUserSetting($key); | $setting = $viewer->getUserSetting($key); | ||||
| $desktop_ready = PhabricatorNotificationsSetting::desktopReady($setting); | $desktop_ready = PhabricatorNotificationsSetting::desktopReady($setting); | ||||
| $web_ready = PhabricatorNotificationsSetting::webReady($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_ready, | 'showAnyNotification' => $web_ready, | ||||
| 'webReady' => $web_ready, | 'showDesktopNotification' => $desktop_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_ready, | 'showAnyNotification' => $web_ready, | ||||
| 'webReady' => $web_ready, | 'showDesktopNotification' => $desktop_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, | 'showWebNotification' => false, | ||||
| 'webReady' => false, | 'showDesktopNotification' => false, | ||||
| 'title' => null, | 'title' => null, | ||||
epriestley: Er, I think these are probably not wrong exactly but the old version was clearer, I'll use… | |||||
| 'body' => null, | 'body' => null, | ||||
| 'href' => null, | 'href' => null, | ||||
| 'icon' => null, | 'icon' => null, | ||||
| ); | ); | ||||
| } | } | ||||
| } | } | ||||
| return $dict; | return $dict; | ||||
| } | } | ||||
| } | } | ||||
Er, I think these are probably not wrong exactly but the old version was clearer, I'll use something more similar.