@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

Remove motivator panel

Summary: Removes the often funny, but never really used but will cause us bug reports someday.... cat facts.

Test Plan: Install cat facts, run storage upgrade, see no cat facts in menu.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T12126

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

+9 -166
+9
resources/sql/autopatches/20170119.menuitem.motivator.01.php
··· 1 + <?php 2 + 3 + $table = new PhabricatorProfileMenuItemConfiguration(); 4 + $conn_w = $table->establishConnection('w'); 5 + 6 + queryfx( 7 + $conn_w, 8 + 'DELETE FROM %T WHERE menuItemKey = "motivator"', 9 + $table->getTableName());
-2
src/__phutil_library_map__.php
··· 3020 3020 'PhabricatorModularTransactionType' => 'applications/transactions/storage/PhabricatorModularTransactionType.php', 3021 3021 'PhabricatorMonospacedFontSetting' => 'applications/settings/setting/PhabricatorMonospacedFontSetting.php', 3022 3022 'PhabricatorMonospacedTextareasSetting' => 'applications/settings/setting/PhabricatorMonospacedTextareasSetting.php', 3023 - 'PhabricatorMotivatorProfileMenuItem' => 'applications/search/menuitem/PhabricatorMotivatorProfileMenuItem.php', 3024 3023 'PhabricatorMultiColumnUIExample' => 'applications/uiexample/examples/PhabricatorMultiColumnUIExample.php', 3025 3024 'PhabricatorMultiFactorSettingsPanel' => 'applications/settings/panel/PhabricatorMultiFactorSettingsPanel.php', 3026 3025 'PhabricatorMultimeterApplication' => 'applications/multimeter/application/PhabricatorMultimeterApplication.php', ··· 8081 8080 'PhabricatorModularTransactionType' => 'Phobject', 8082 8081 'PhabricatorMonospacedFontSetting' => 'PhabricatorStringSetting', 8083 8082 'PhabricatorMonospacedTextareasSetting' => 'PhabricatorSelectSetting', 8084 - 'PhabricatorMotivatorProfileMenuItem' => 'PhabricatorProfileMenuItem', 8085 8083 'PhabricatorMultiColumnUIExample' => 'PhabricatorUIExample', 8086 8084 'PhabricatorMultiFactorSettingsPanel' => 'PhabricatorSettingsPanel', 8087 8085 'PhabricatorMultimeterApplication' => 'PhabricatorApplication',
-164
src/applications/search/menuitem/PhabricatorMotivatorProfileMenuItem.php
··· 1 - <?php 2 - 3 - final class PhabricatorMotivatorProfileMenuItem 4 - extends PhabricatorProfileMenuItem { 5 - 6 - const MENUITEMKEY = 'motivator'; 7 - 8 - public function getMenuItemTypeIcon() { 9 - return 'fa-coffee'; 10 - } 11 - 12 - public function getMenuItemTypeName() { 13 - return pht('Motivator'); 14 - } 15 - 16 - public function canAddToObject($object) { 17 - return true; 18 - } 19 - 20 - public function getDisplayName( 21 - PhabricatorProfileMenuItemConfiguration $config) { 22 - 23 - $options = $this->getOptions(); 24 - $name = idx($options, $config->getMenuItemProperty('source')); 25 - if ($name !== null) { 26 - return pht('Motivator: %s', $name); 27 - } else { 28 - return pht('Motivator'); 29 - } 30 - } 31 - 32 - public function buildEditEngineFields( 33 - PhabricatorProfileMenuItemConfiguration $config) { 34 - return array( 35 - id(new PhabricatorInstructionsEditField()) 36 - ->setValue( 37 - pht( 38 - 'Motivate your team with inspirational quotes from great minds. '. 39 - 'This menu item shows a new quote every day.')), 40 - id(new PhabricatorSelectEditField()) 41 - ->setKey('source') 42 - ->setLabel(pht('Source')) 43 - ->setOptions($this->getOptions()), 44 - ); 45 - } 46 - 47 - private function getOptions() { 48 - return array( 49 - 'catfacts' => pht('Cat Facts'), 50 - ); 51 - } 52 - 53 - protected function newNavigationMenuItems( 54 - PhabricatorProfileMenuItemConfiguration $config) { 55 - 56 - $source = $config->getMenuItemProperty('source'); 57 - 58 - switch ($source) { 59 - case 'catfacts': 60 - default: 61 - $facts = $this->getCatFacts(); 62 - break; 63 - } 64 - 65 - $fact = $this->selectFact($facts); 66 - 67 - switch ($source) { 68 - case 'catfacts': 69 - default: 70 - $fact = array( 71 - id(new PHUIIconView())->setIcon('fa-paw'), 72 - ' ', 73 - $fact, 74 - ); 75 - break; 76 - } 77 - 78 - $fact = phutil_tag( 79 - 'div', 80 - array( 81 - 'class' => 'phui-motivator', 82 - ), 83 - $fact); 84 - 85 - $item = $this->newItem() 86 - ->appendChild($fact); 87 - 88 - return array( 89 - $item, 90 - ); 91 - } 92 - 93 - private function getCatFacts() { 94 - return array( 95 - pht('Cats purr when they are happy, upset, or asleep.'), 96 - pht('The first cats evolved on the savanah about 8,000 years ago.'), 97 - pht( 98 - 'Cats have a tail, two feet, between one and three ears, and two '. 99 - 'other feet.'), 100 - pht('Cats use their keen sense of smell to avoid feeling empathy.'), 101 - pht('The first cats evolved in swamps about 65 years ago.'), 102 - pht( 103 - 'You can tell how warm a cat is by examining the coloration: cooler '. 104 - 'areas are darker.'), 105 - pht( 106 - 'Cat tails are flexible because they contain thousands of tiny '. 107 - 'bones.'), 108 - pht( 109 - 'A cattail is a wetland plant with an appearance that resembles '. 110 - 'the tail of a cat.'), 111 - pht( 112 - 'Cats must eat a diet rich in fish to replace the tiny bones in '. 113 - 'their tails.'), 114 - pht('Cats are stealthy predators and nearly invisible to radar.'), 115 - pht( 116 - 'Cats use a special type of magnetism to help them land on their '. 117 - 'feet.'), 118 - pht( 119 - 'A cat can run seven times faster than a human, but only for a '. 120 - 'short distance.'), 121 - pht( 122 - 'The largest recorded cat was nearly 11 inches long from nose to '. 123 - 'tail.'), 124 - pht( 125 - 'Not all cats can retract their claws, but most of them can.'), 126 - pht( 127 - 'In the wild, cats and racoons sometimes hunt together in packs.'), 128 - pht( 129 - 'The Spanish word for cat is "cato". The biggest cat is called '. 130 - '"el cato".'), 131 - pht( 132 - 'The Japanese word for cat is "kome", which is also the word for '. 133 - 'rice. Japanese cats love to eat rice, so the two are synonymous.'), 134 - pht('Cats have five pointy ends.'), 135 - pht('cat -A can find mice hiding in files.'), 136 - pht('A cat\'s visual, olfactory, and auditory senses, '. 137 - 'Contribute to their hunting skills and natural defenses.'), 138 - pht( 139 - 'Cats with high self-esteem seek out high perches '. 140 - 'to launch their attacks. Watch out!'), 141 - pht('Cats prefer vanilla ice cream.'), 142 - pht('Taco cat spelled backwards is taco cat.'), 143 - pht( 144 - 'Cats will often bring you their prey because they feel sorry '. 145 - 'for your inability to hunt.'), 146 - pht('Cats spend most of their time plotting to kill their owner.'), 147 - ); 148 - } 149 - 150 - private function selectFact(array $facts) { 151 - // This is a simple pseudorandom number generator that avoids touching 152 - // srand(), because it would seed it to a highly predictable value. It 153 - // selects a new fact every day. 154 - 155 - $seed = ((int)date('Y') * 366) + (int)date('z'); 156 - for ($ii = 0; $ii < 32; $ii++) { 157 - $seed = ((1664525 * $seed) + 1013904223) % (1 << 31); 158 - } 159 - 160 - return $facts[$seed % count($facts)]; 161 - } 162 - 163 - 164 - }