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

View file

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

View file

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