Page MenuHomePhabricator

D17699.id42567.diff
No OneTemporary

D17699.id42567.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -2396,6 +2396,8 @@
'PhabricatorConpherenceNotificationsSetting' => 'applications/settings/setting/PhabricatorConpherenceNotificationsSetting.php',
'PhabricatorConpherencePreferencesSettingsPanel' => 'applications/settings/panel/PhabricatorConpherencePreferencesSettingsPanel.php',
'PhabricatorConpherenceProfileMenuItem' => 'applications/search/menuitem/PhabricatorConpherenceProfileMenuItem.php',
+ 'PhabricatorConpherenceRoomContextFreeGrammar' => 'applications/conpherence/lipsum/PhabricatorConpherenceRoomContextFreeGrammar.php',
+ 'PhabricatorConpherenceRoomTestDataGenerator' => 'applications/conpherence/lipsum/PhabricatorConpherenceRoomTestDataGenerator.php',
'PhabricatorConpherenceThreadPHIDType' => 'applications/conpherence/phid/PhabricatorConpherenceThreadPHIDType.php',
'PhabricatorConpherenceWidgetVisibleSetting' => 'applications/settings/setting/PhabricatorConpherenceWidgetVisibleSetting.php',
'PhabricatorConsoleApplication' => 'applications/console/application/PhabricatorConsoleApplication.php',
@@ -7499,6 +7501,8 @@
'PhabricatorConpherenceNotificationsSetting' => 'PhabricatorSelectSetting',
'PhabricatorConpherencePreferencesSettingsPanel' => 'PhabricatorEditEngineSettingsPanel',
'PhabricatorConpherenceProfileMenuItem' => 'PhabricatorProfileMenuItem',
+ 'PhabricatorConpherenceRoomContextFreeGrammar' => 'PhutilContextFreeGrammar',
+ 'PhabricatorConpherenceRoomTestDataGenerator' => 'PhabricatorTestDataGenerator',
'PhabricatorConpherenceThreadPHIDType' => 'PhabricatorPHIDType',
'PhabricatorConpherenceWidgetVisibleSetting' => 'PhabricatorInternalSetting',
'PhabricatorConsoleApplication' => 'PhabricatorApplication',
diff --git a/src/applications/conpherence/lipsum/PhabricatorConpherenceRoomContextFreeGrammar.php b/src/applications/conpherence/lipsum/PhabricatorConpherenceRoomContextFreeGrammar.php
new file mode 100644
--- /dev/null
+++ b/src/applications/conpherence/lipsum/PhabricatorConpherenceRoomContextFreeGrammar.php
@@ -0,0 +1,97 @@
+<?php
+
+final class PhabricatorConpherenceRoomContextFreeGrammar
+ extends PhutilContextFreeGrammar {
+ protected function getRules() {
+ return array(
+ 'start' => array(
+ '[dept]',
+ '[dept]',
+ '[dept]',
+ '[dept]',
+ '[dept]',
+ '[dept]',
+ '[dept]',
+ '[dept] ([city])',
+ '[dept] ([city])',
+ '[dept] ([city])',
+ '[dept] - [room]',
+ '[dept] [room]',
+ '[dept] [room]',
+ '[dept] ([city]) - [room]',
+ '[dept] ([city]) - [room]',
+ '[dept] ([city]) [room]',
+ ),
+ 'dept' => array(
+ 'Eng',
+ 'Engineering',
+ 'User Interface',
+ 'Design',
+ 'Data Science',
+ 'Database',
+ 'Marketing',
+ 'Content',
+ 'Ads',
+ 'Operations',
+ 'Network Ops',
+ 'Ops',
+ 'Server Ops',
+ 'IT',
+ 'Information Technology',
+ 'i18n',
+ 'Internationalization',
+ 'Human Resources',
+ 'HR',
+ 'Research & Development',
+ 'R&D',
+ 'Management',
+ 'Directors',
+ 'Managers',
+ 'Support',
+ 'Customer Support',
+ 'Finance',
+ 'Sales',
+ 'Purchasing',
+ 'Education',
+ 'Hardware Engineering',
+ 'Software',
+ 'Supply Management',
+ 'Logistics',
+ 'Growth',
+ 'Content Strategy',
+ 'Developer Relations',
+ 'Accounting',
+ 'Production',
+ ),
+ 'city' => array(
+ 'Palo Alto',
+ 'Mtn View',
+ 'Cupertino',
+ 'Los Altos',
+ 'Menlo Park',
+ 'Santa Cruz',
+ 'S.F.',
+ 'San Francisco',
+ 'Seattle',
+ 'London',
+ 'New York',
+ 'Dublin',
+ 'Tokyo',
+ ),
+ 'room' => array(
+ 'General',
+ 'Announcements',
+ 'Staff',
+ 'Interns',
+ 'Managers',
+ 'Book Club',
+ 'Parking',
+ 'Sports',
+ 'Social',
+ 'Commuting',
+ 'For Sale',
+ 'Parents@',
+ ),
+ );
+ }
+}
diff --git a/src/applications/conpherence/lipsum/PhabricatorConpherenceRoomTestDataGenerator.php b/src/applications/conpherence/lipsum/PhabricatorConpherenceRoomTestDataGenerator.php
new file mode 100644
--- /dev/null
+++ b/src/applications/conpherence/lipsum/PhabricatorConpherenceRoomTestDataGenerator.php
@@ -0,0 +1,61 @@
+<?php
+
+final class PhabricatorConpherenceRoomTestDataGenerator
+ extends PhabricatorTestDataGenerator {
+
+ const GENERATORKEY = 'conpherence';
+
+ public function getGeneratorName() {
+ return pht('Conpherence');
+ }
+
+ public function generateObject() {
+ $author = $this->loadRandomUser();
+
+ $title = $this->newRoomTitle();
+
+ $participants = array();
+ $participants[] = $this->loadRandomUser();
+ $participants[] = $this->loadRandomUser();
+ $participants[] = $this->loadRandomUser();
+ $participants[] = $this->loadRandomUser();
+ $participants[] = $this->loadRandomUser();
+
+ $rando_phids = array();
+ $rando_phids[] = $author->getPHID();
+ foreach ($participants as $actor) {
+ $rando_phids[] = $actor->getPHID();
+ }
+
+ $xactions = array();
+
+ $xactions[] = array(
+ 'type' => 'title',
+ 'value' => $title,
+ );
+
+ $xactions[] = array(
+ 'type' => 'participantPHIDs',
+ 'value' => $rando_phids,
+ );
+
+ $params = array(
+ 'transactions' => $xactions,
+ );
+
+ $result = id(new ConduitCall('conpherence.createthread', $params))
+ ->setUser($author)
+ ->execute();
+
+ return $result['object']['phid'];
+ }
+
+ protected function newRoomTitle() {
+ $generator = new PhabricatorConpherenceRoomContextFreeGrammar();
+ $title = $generator->generate();
+ return $title;
+ }
+
+
+
+}

File Metadata

Mime Type
text/plain
Expires
Thu, Mar 20, 11:09 AM (2 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7713006
Default Alt Text
D17699.id42567.diff (5 KB)

Event Timeline