@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Notifications - hide header dropdown if app is uninstalled

Summary: Fixes T5019.

Test Plan: uninstalled notifications and dropdown disappeared too

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T5019

Differential Revision: https://secure.phabricator.com/D9121

+75 -64
+75 -64
src/view/page/menu/PhabricatorMainMenuView.php
··· 38 38 39 39 if ($user->isLoggedIn() && $user->isUserActivated()) { 40 40 list($menu, $dropdowns, $aural) = $this->renderNotificationMenu(); 41 - $alerts[] = $menu; 41 + if (array_filter($menu)) { 42 + $alerts[] = $menu; 43 + } 42 44 $menus = array_merge($menus, $dropdowns); 43 45 $app_button = $this->renderApplicationMenuButton($header_id); 44 46 $search_button = $this->renderSearchMenuButton($header_id); ··· 281 283 $message_tag = ''; 282 284 $message_notification_dropdown = ''; 283 285 $conpherence = 'PhabricatorApplicationConpherence'; 284 - if (PhabricatorApplication::isClassInstalled($conpherence)) { 286 + if (PhabricatorApplication::isClassInstalledForViewer( 287 + $conpherence, 288 + $user)) { 285 289 $message_id = celerity_generate_unique_node_id(); 286 290 $message_count_id = celerity_generate_unique_node_id(); 287 291 $message_dropdown_id = celerity_generate_unique_node_id(); ··· 362 366 ''); 363 367 } 364 368 365 - $count_id = celerity_generate_unique_node_id(); 366 - $dropdown_id = celerity_generate_unique_node_id(); 367 - $bubble_id = celerity_generate_unique_node_id(); 369 + $bubble_tag = ''; 370 + $notification_dropdown = ''; 371 + $notification_app = 'PhabricatorApplicationNotifications'; 372 + if (PhabricatorApplication::isClassInstalledForViewer( 373 + $notification_app, 374 + $user)) { 375 + $count_id = celerity_generate_unique_node_id(); 376 + $dropdown_id = celerity_generate_unique_node_id(); 377 + $bubble_id = celerity_generate_unique_node_id(); 368 378 369 - $count_number = id(new PhabricatorFeedStoryNotification()) 370 - ->countUnread($user); 379 + $count_number = id(new PhabricatorFeedStoryNotification()) 380 + ->countUnread($user); 371 381 372 - if ($count_number) { 373 - $aural[] = phutil_tag( 374 - 'a', 382 + if ($count_number) { 383 + $aural[] = phutil_tag( 384 + 'a', 385 + array( 386 + 'href' => '/notification/', 387 + ), 388 + pht( 389 + '%s unread notifications.', 390 + new PhutilNumber($count_number))); 391 + } else { 392 + $aural[] = pht('No notifications.'); 393 + } 394 + 395 + if ($count_number > 999) { 396 + $count_number = "\xE2\x88\x9E"; 397 + } 398 + 399 + $count_tag = phutil_tag( 400 + 'span', 375 401 array( 376 - 'href' => '/notification/', 402 + 'id' => $count_id, 403 + 'class' => 'phabricator-main-menu-alert-count' 377 404 ), 378 - pht( 379 - '%s unread notifications.', 380 - new PhutilNumber($count_number))); 381 - } else { 382 - $aural[] = pht('No notifications.'); 383 - } 405 + $count_number); 384 406 385 - if ($count_number > 999) { 386 - $count_number = "\xE2\x88\x9E"; 387 - } 407 + $icon_tag = phutil_tag( 408 + 'span', 409 + array( 410 + 'class' => 'sprite-menu phabricator-main-menu-alert-icon', 411 + ), 412 + ''); 388 413 389 - $count_tag = phutil_tag( 390 - 'span', 391 - array( 392 - 'id' => $count_id, 393 - 'class' => 'phabricator-main-menu-alert-count' 394 - ), 395 - $count_number); 414 + if ($count_number) { 415 + $container_classes[] = 'alert-unread'; 416 + } 417 + 418 + $bubble_tag = phutil_tag( 419 + 'a', 420 + array( 421 + 'href' => '/notification/', 422 + 'class' => implode(' ', $container_classes), 423 + 'id' => $bubble_id, 424 + ), 425 + array($icon_tag, $count_tag)); 396 426 397 - $icon_tag = phutil_tag( 398 - 'span', 399 - array( 400 - 'class' => 'sprite-menu phabricator-main-menu-alert-icon', 401 - ), 402 - ''); 427 + Javelin::initBehavior( 428 + 'aphlict-dropdown', 429 + array( 430 + 'bubbleID' => $bubble_id, 431 + 'countID' => $count_id, 432 + 'dropdownID' => $dropdown_id, 433 + 'loadingText' => pht('Loading...'), 434 + 'uri' => '/notification/panel/', 435 + )); 403 436 404 - if ($count_number) { 405 - $container_classes[] = 'alert-unread'; 437 + $notification_dropdown = javelin_tag( 438 + 'div', 439 + array( 440 + 'id' => $dropdown_id, 441 + 'class' => 'phabricator-notification-menu', 442 + 'sigil' => 'phabricator-notification-menu', 443 + 'style' => 'display: none;', 444 + ), 445 + ''); 406 446 } 407 - 408 - $bubble_tag = phutil_tag( 409 - 'a', 410 - array( 411 - 'href' => '/notification/', 412 - 'class' => implode(' ', $container_classes), 413 - 'id' => $bubble_id, 414 - ), 415 - array($icon_tag, $count_tag)); 416 - 417 - Javelin::initBehavior( 418 - 'aphlict-dropdown', 419 - array( 420 - 'bubbleID' => $bubble_id, 421 - 'countID' => $count_id, 422 - 'dropdownID' => $dropdown_id, 423 - 'loadingText' => pht('Loading...'), 424 - 'uri' => '/notification/panel/', 425 - )); 426 - 427 - $notification_dropdown = javelin_tag( 428 - 'div', 429 - array( 430 - 'id' => $dropdown_id, 431 - 'class' => 'phabricator-notification-menu', 432 - 'sigil' => 'phabricator-notification-menu', 433 - 'style' => 'display: none;', 434 - ), 435 - ''); 436 447 437 448 $dropdowns = array( 438 449 $notification_dropdown,