@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.

Add a lipsum generator for Conpherence Rooms

Summary: Builds a basic room generator for Conpherence, picks a random name, adds 10 random users to it, sets view and edit policy to all users.

Test Plan:
`bin/lipsum generate conpherence`

{F4928815}

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

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

+198
+6
src/__phutil_library_map__.php
··· 292 292 'ConpherenceCreateThreadConduitAPIMethod' => 'applications/conpherence/conduit/ConpherenceCreateThreadConduitAPIMethod.php', 293 293 'ConpherenceDAO' => 'applications/conpherence/storage/ConpherenceDAO.php', 294 294 'ConpherenceDurableColumnView' => 'applications/conpherence/view/ConpherenceDurableColumnView.php', 295 + 'ConpherenceEditConduitAPIMethod' => 'applications/conpherence/conduit/ConpherenceEditConduitAPIMethod.php', 295 296 'ConpherenceEditEngine' => 'applications/conpherence/editor/ConpherenceEditEngine.php', 296 297 'ConpherenceEditor' => 'applications/conpherence/editor/ConpherenceEditor.php', 297 298 'ConpherenceFulltextQuery' => 'applications/conpherence/query/ConpherenceFulltextQuery.php', ··· 2390 2391 'PhabricatorConpherenceNotificationsSetting' => 'applications/settings/setting/PhabricatorConpherenceNotificationsSetting.php', 2391 2392 'PhabricatorConpherencePreferencesSettingsPanel' => 'applications/settings/panel/PhabricatorConpherencePreferencesSettingsPanel.php', 2392 2393 'PhabricatorConpherenceProfileMenuItem' => 'applications/search/menuitem/PhabricatorConpherenceProfileMenuItem.php', 2394 + 'PhabricatorConpherenceRoomContextFreeGrammar' => 'applications/conpherence/lipsum/PhabricatorConpherenceRoomContextFreeGrammar.php', 2395 + 'PhabricatorConpherenceRoomTestDataGenerator' => 'applications/conpherence/lipsum/PhabricatorConpherenceRoomTestDataGenerator.php', 2393 2396 'PhabricatorConpherenceSoundSetting' => 'applications/settings/setting/PhabricatorConpherenceSoundSetting.php', 2394 2397 'PhabricatorConpherenceThreadPHIDType' => 'applications/conpherence/phid/PhabricatorConpherenceThreadPHIDType.php', 2395 2398 'PhabricatorConpherenceWidgetVisibleSetting' => 'applications/settings/setting/PhabricatorConpherenceWidgetVisibleSetting.php', ··· 5075 5078 'ConpherenceCreateThreadConduitAPIMethod' => 'ConpherenceConduitAPIMethod', 5076 5079 'ConpherenceDAO' => 'PhabricatorLiskDAO', 5077 5080 'ConpherenceDurableColumnView' => 'AphrontTagView', 5081 + 'ConpherenceEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod', 5078 5082 'ConpherenceEditEngine' => 'PhabricatorEditEngine', 5079 5083 'ConpherenceEditor' => 'PhabricatorApplicationTransactionEditor', 5080 5084 'ConpherenceFulltextQuery' => 'PhabricatorOffsetPagedQuery', ··· 7489 7493 'PhabricatorConpherenceNotificationsSetting' => 'PhabricatorSelectSetting', 7490 7494 'PhabricatorConpherencePreferencesSettingsPanel' => 'PhabricatorEditEngineSettingsPanel', 7491 7495 'PhabricatorConpherenceProfileMenuItem' => 'PhabricatorProfileMenuItem', 7496 + 'PhabricatorConpherenceRoomContextFreeGrammar' => 'PhutilContextFreeGrammar', 7497 + 'PhabricatorConpherenceRoomTestDataGenerator' => 'PhabricatorTestDataGenerator', 7492 7498 'PhabricatorConpherenceSoundSetting' => 'PhabricatorSelectSetting', 7493 7499 'PhabricatorConpherenceThreadPHIDType' => 'PhabricatorPHIDType', 7494 7500 'PhabricatorConpherenceWidgetVisibleSetting' => 'PhabricatorInternalSetting',
+19
src/applications/conpherence/conduit/ConpherenceEditConduitAPIMethod.php
··· 1 + <?php 2 + 3 + final class ConpherenceEditConduitAPIMethod 4 + extends PhabricatorEditEngineAPIMethod { 5 + 6 + public function getAPIMethodName() { 7 + return 'conpherence.edit'; 8 + } 9 + 10 + public function newEditEngine() { 11 + return new ConpherenceEditEngine(); 12 + } 13 + 14 + public function getMethodSummary() { 15 + return pht( 16 + 'Apply transactions to create a new room or edit an existing one.'); 17 + } 18 + 19 + }
+97
src/applications/conpherence/lipsum/PhabricatorConpherenceRoomContextFreeGrammar.php
··· 1 + <?php 2 + 3 + final class PhabricatorConpherenceRoomContextFreeGrammar 4 + extends PhutilContextFreeGrammar { 5 + protected function getRules() { 6 + return array( 7 + 'start' => array( 8 + '[dept]', 9 + '[dept]', 10 + '[dept]', 11 + '[dept]', 12 + '[dept]', 13 + '[dept]', 14 + '[dept]', 15 + '[dept] ([city])', 16 + '[dept] ([city])', 17 + '[dept] - [city]', 18 + '[dept] - [room]', 19 + '[dept] / [room]', 20 + '[dept] [room]', 21 + '[city] ([dept]) - [room]', 22 + '[dept] ([city]) - [room]', 23 + '[dept] ([city]) [room]', 24 + ), 25 + 'dept' => array( 26 + 'Eng', 27 + 'Engineering', 28 + 'User Interface', 29 + 'Design', 30 + 'Data Science', 31 + 'Database', 32 + 'Marketing', 33 + 'Content', 34 + 'Ads', 35 + 'Operations', 36 + 'Network Ops', 37 + 'Ops', 38 + 'Server Ops', 39 + 'IT', 40 + 'Information Technology', 41 + 'i18n', 42 + 'Internationalization', 43 + 'Human Resources', 44 + 'HR', 45 + 'Research & Development', 46 + 'R&D', 47 + 'Management', 48 + 'Directors', 49 + 'Managers', 50 + 'Support', 51 + 'Customer Support', 52 + 'Finance', 53 + 'Sales', 54 + 'Purchasing', 55 + 'Education', 56 + 'Hardware Engineering', 57 + 'Software', 58 + 'Supply Management', 59 + 'Logistics', 60 + 'Growth', 61 + 'Content Strategy', 62 + 'Developer Relations', 63 + 'Accounting', 64 + 'Production', 65 + ), 66 + 'city' => array( 67 + 'Palo Alto', 68 + 'Mtn View', 69 + 'Cupertino', 70 + 'Los Altos', 71 + 'Menlo Park', 72 + 'Santa Cruz', 73 + 'S.F.', 74 + 'San Francisco', 75 + 'Seattle', 76 + 'London', 77 + 'New York', 78 + 'Dublin', 79 + 'Tokyo', 80 + ), 81 + 'room' => array( 82 + 'General', 83 + 'Announcements', 84 + 'Staff', 85 + 'Interns', 86 + 'Managers', 87 + 'Book Club', 88 + 'Parking', 89 + 'Sports', 90 + 'Social', 91 + 'Commuting', 92 + 'For Sale', 93 + 'Parents@', 94 + ), 95 + ); 96 + } 97 + }
+76
src/applications/conpherence/lipsum/PhabricatorConpherenceRoomTestDataGenerator.php
··· 1 + <?php 2 + 3 + final class PhabricatorConpherenceRoomTestDataGenerator 4 + extends PhabricatorTestDataGenerator { 5 + 6 + const GENERATORKEY = 'conpherence'; 7 + 8 + public function getGeneratorName() { 9 + return pht('Conpherence'); 10 + } 11 + 12 + public function generateObject() { 13 + $author = $this->loadRandomUser(); 14 + 15 + $name = $this->newRoomName(); 16 + 17 + $participants = array(); 18 + $participants[] = $this->loadRandomUser(); 19 + $participants[] = $this->loadRandomUser(); 20 + $participants[] = $this->loadRandomUser(); 21 + $participants[] = $this->loadRandomUser(); 22 + $participants[] = $this->loadRandomUser(); 23 + $participants[] = $this->loadRandomUser(); 24 + $participants[] = $this->loadRandomUser(); 25 + $participants[] = $this->loadRandomUser(); 26 + $participants[] = $this->loadRandomUser(); 27 + $participants[] = $this->loadRandomUser(); 28 + 29 + $rando_phids = array(); 30 + $rando_phids[] = $author->getPHID(); 31 + foreach ($participants as $actor) { 32 + $rando_phids[] = $actor->getPHID(); 33 + } 34 + 35 + $xactions = array(); 36 + 37 + $xactions[] = array( 38 + 'type' => 'name', 39 + 'value' => $name, 40 + ); 41 + 42 + $xactions[] = array( 43 + 'type' => 'participants.set', 44 + 'value' => $rando_phids, 45 + ); 46 + 47 + $xactions[] = array( 48 + 'type' => 'view', 49 + 'value' => 'users', 50 + ); 51 + 52 + $xactions[] = array( 53 + 'type' => 'edit', 54 + 'value' => 'users', 55 + ); 56 + 57 + $params = array( 58 + 'transactions' => $xactions, 59 + ); 60 + 61 + $result = id(new ConduitCall('conpherence.edit', $params)) 62 + ->setUser($author) 63 + ->execute(); 64 + 65 + return $result['object']['phid']; 66 + } 67 + 68 + protected function newRoomName() { 69 + $generator = new PhabricatorConpherenceRoomContextFreeGrammar(); 70 + $name = $generator->generate(); 71 + return $name; 72 + } 73 + 74 + 75 + 76 + }