Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15435024
D17699.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
8 KB
Referenced Files
None
Subscribers
None
D17699.diff
View Options
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
@@ -292,6 +292,7 @@
'ConpherenceCreateThreadConduitAPIMethod' => 'applications/conpherence/conduit/ConpherenceCreateThreadConduitAPIMethod.php',
'ConpherenceDAO' => 'applications/conpherence/storage/ConpherenceDAO.php',
'ConpherenceDurableColumnView' => 'applications/conpherence/view/ConpherenceDurableColumnView.php',
+ 'ConpherenceEditConduitAPIMethod' => 'applications/conpherence/conduit/ConpherenceEditConduitAPIMethod.php',
'ConpherenceEditEngine' => 'applications/conpherence/editor/ConpherenceEditEngine.php',
'ConpherenceEditor' => 'applications/conpherence/editor/ConpherenceEditor.php',
'ConpherenceFulltextQuery' => 'applications/conpherence/query/ConpherenceFulltextQuery.php',
@@ -2390,6 +2391,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',
'PhabricatorConpherenceSoundSetting' => 'applications/settings/setting/PhabricatorConpherenceSoundSetting.php',
'PhabricatorConpherenceThreadPHIDType' => 'applications/conpherence/phid/PhabricatorConpherenceThreadPHIDType.php',
'PhabricatorConpherenceWidgetVisibleSetting' => 'applications/settings/setting/PhabricatorConpherenceWidgetVisibleSetting.php',
@@ -5075,6 +5078,7 @@
'ConpherenceCreateThreadConduitAPIMethod' => 'ConpherenceConduitAPIMethod',
'ConpherenceDAO' => 'PhabricatorLiskDAO',
'ConpherenceDurableColumnView' => 'AphrontTagView',
+ 'ConpherenceEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod',
'ConpherenceEditEngine' => 'PhabricatorEditEngine',
'ConpherenceEditor' => 'PhabricatorApplicationTransactionEditor',
'ConpherenceFulltextQuery' => 'PhabricatorOffsetPagedQuery',
@@ -7489,6 +7493,8 @@
'PhabricatorConpherenceNotificationsSetting' => 'PhabricatorSelectSetting',
'PhabricatorConpherencePreferencesSettingsPanel' => 'PhabricatorEditEngineSettingsPanel',
'PhabricatorConpherenceProfileMenuItem' => 'PhabricatorProfileMenuItem',
+ 'PhabricatorConpherenceRoomContextFreeGrammar' => 'PhutilContextFreeGrammar',
+ 'PhabricatorConpherenceRoomTestDataGenerator' => 'PhabricatorTestDataGenerator',
'PhabricatorConpherenceSoundSetting' => 'PhabricatorSelectSetting',
'PhabricatorConpherenceThreadPHIDType' => 'PhabricatorPHIDType',
'PhabricatorConpherenceWidgetVisibleSetting' => 'PhabricatorInternalSetting',
diff --git a/src/applications/conpherence/conduit/ConpherenceEditConduitAPIMethod.php b/src/applications/conpherence/conduit/ConpherenceEditConduitAPIMethod.php
new file mode 100644
--- /dev/null
+++ b/src/applications/conpherence/conduit/ConpherenceEditConduitAPIMethod.php
@@ -0,0 +1,19 @@
+<?php
+
+final class ConpherenceEditConduitAPIMethod
+ extends PhabricatorEditEngineAPIMethod {
+
+ public function getAPIMethodName() {
+ return 'conpherence.edit';
+ }
+
+ public function newEditEngine() {
+ return new ConpherenceEditEngine();
+ }
+
+ public function getMethodSummary() {
+ return pht(
+ 'Apply transactions to create a new room or edit an existing one.');
+ }
+
+}
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]',
+ '[city] ([dept]) - [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,76 @@
+<?php
+
+final class PhabricatorConpherenceRoomTestDataGenerator
+ extends PhabricatorTestDataGenerator {
+
+ const GENERATORKEY = 'conpherence';
+
+ public function getGeneratorName() {
+ return pht('Conpherence');
+ }
+
+ public function generateObject() {
+ $author = $this->loadRandomUser();
+
+ $name = $this->newRoomName();
+
+ $participants = array();
+ $participants[] = $this->loadRandomUser();
+ $participants[] = $this->loadRandomUser();
+ $participants[] = $this->loadRandomUser();
+ $participants[] = $this->loadRandomUser();
+ $participants[] = $this->loadRandomUser();
+ $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' => 'name',
+ 'value' => $name,
+ );
+
+ $xactions[] = array(
+ 'type' => 'participants.set',
+ 'value' => $rando_phids,
+ );
+
+ $xactions[] = array(
+ 'type' => 'view',
+ 'value' => 'users',
+ );
+
+ $xactions[] = array(
+ 'type' => 'edit',
+ 'value' => 'users',
+ );
+
+ $params = array(
+ 'transactions' => $xactions,
+ );
+
+ $result = id(new ConduitCall('conpherence.edit', $params))
+ ->setUser($author)
+ ->execute();
+
+ return $result['object']['phid'];
+ }
+
+ protected function newRoomName() {
+ $generator = new PhabricatorConpherenceRoomContextFreeGrammar();
+ $name = $generator->generate();
+ return $name;
+ }
+
+
+
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 26, 6:31 AM (1 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7606076
Default Alt Text
D17699.diff (8 KB)
Attached To
Mode
D17699: Add a lipsum generator for Conpherence Rooms
Attached
Detach File
Event Timeline
Log In to Comment