1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 14:00:56 +01:00

Fix bad JS rendering in "Allow Desktop Notifications" workflow

Summary:
See downstream <https://phabricator.kde.org/T5404>. This code was doing some `.firstChild` shenanigans which didn't survive some UI refactoring.

This whole UI is a little iffy but just unbreak it for now.

Test Plan: Allowed and rejected desktop notifications, got largely reasonable UI rendering.

Reviewers: chad

Reviewed By: chad

Differential Revision: https://secure.phabricator.com/D17388
This commit is contained in:
epriestley 2017-02-20 12:48:37 -08:00
parent 9f3cde4db7
commit ab9c1b73b5
3 changed files with 30 additions and 16 deletions

View file

@ -376,7 +376,7 @@ return array(
'rsrc/js/application/aphlict/behavior-aphlict-dropdown.js' => 'caade6f2',
'rsrc/js/application/aphlict/behavior-aphlict-listen.js' => 'fb20ac8d',
'rsrc/js/application/aphlict/behavior-aphlict-status.js' => '5e2634b9',
'rsrc/js/application/aphlict/behavior-desktop-notifications-control.js' => 'edd1ba66',
'rsrc/js/application/aphlict/behavior-desktop-notifications-control.js' => 'd5a2d665',
'rsrc/js/application/calendar/behavior-day-view.js' => '4b3c4443',
'rsrc/js/application/calendar/behavior-event-all-day.js' => 'b41537c9',
'rsrc/js/application/calendar/behavior-month-view.js' => 'fe33e256',
@ -621,7 +621,7 @@ return array(
'javelin-behavior-dashboard-query-panel-select' => '453c5375',
'javelin-behavior-dashboard-tab-panel' => 'd4eecc63',
'javelin-behavior-day-view' => '4b3c4443',
'javelin-behavior-desktop-notifications-control' => 'edd1ba66',
'javelin-behavior-desktop-notifications-control' => 'd5a2d665',
'javelin-behavior-detect-timezone' => '4c193c96',
'javelin-behavior-device' => 'bb1dd507',
'javelin-behavior-diff-preview-link' => '051c7832',
@ -2060,6 +2060,13 @@ return array(
'javelin-dom',
'javelin-stratcom',
),
'd5a2d665' => array(
'javelin-behavior',
'javelin-stratcom',
'javelin-dom',
'javelin-uri',
'phabricator-notification',
),
'd6a7e717' => array(
'multirow-row-manager',
'javelin-install',
@ -2154,13 +2161,6 @@ return array(
'javelin-dom',
'phabricator-draggable-list',
),
'edd1ba66' => array(
'javelin-behavior',
'javelin-stratcom',
'javelin-dom',
'javelin-uri',
'phabricator-notification',
),
'edf8a145' => array(
'javelin-behavior',
'javelin-uri',

View file

@ -88,15 +88,25 @@ final class PhabricatorDesktopNotificationsSettingsPanel
'for this Phabricator instance. Consult your browser settings / '.
'documentation to figure out how to clear this setting, do so, '.
'and then re-visit this page to grant permission.'));
$message_id = celerity_generate_unique_node_id();
$message_container = phutil_tag(
'span',
array(
'id' => $message_id,
));
$status_box = id(new PHUIInfoView())
->setSeverity(PHUIInfoView::SEVERITY_NOTICE)
->setID($status_id)
->setIsHidden(true)
->appendChild($accept_ask);
->appendChild($message_container);
$control_config = array(
'controlID' => $control_id,
'statusID' => $status_id,
'messageID' => $message_id,
'browserStatusID' => $browser_status_id,
'defaultMode' => 0,
'desktopMode' => 1,

View file

@ -19,22 +19,26 @@ JX.behavior('desktop-notifications-control', function(config, statics) {
return el;
}
function updateFormStatus(permission) {
var statusEl = findEl(config.statusID);
if (!statusEl) {
var status_node = findEl(config.statusID);
if (!status_node) {
return;
}
var message_node = JX.$(config.messageID);
switch (permission) {
case 'default':
JX.DOM.setContent(statusEl.firstChild, config.cancelAsk);
JX.DOM.setContent(message_node, config.cancelAsk);
break;
case 'granted':
JX.DOM.setContent(statusEl.firstChild, config.grantedAsk);
JX.DOM.setContent(message_node, config.grantedAsk);
break;
case 'denied':
JX.DOM.setContent(statusEl.firstChild, config.deniedAsk);
JX.DOM.setContent(message_node, config.deniedAsk);
break;
}
JX.DOM.show(statusEl);
JX.DOM.show(status_node);
}
function updateBrowserStatus(permission) {