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

Conpherence - make adding participants be a little dialogue.

Summary: and now you can add more than one at a time! Also adds the 'add participants' and 'new calendar event' options to mobile view. Fixes T3251. Ref T3253.

Test Plan: loaded up these "adders" on both desktop and device-ish views and it went well!

Reviewers: epriestley, chad

Reviewed By: chad

CC: chad, aran, Korvin

Maniphest Tasks: T3251, T3253

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

+125 -102
+2 -2
src/__celerity_resource_map__.php
··· 945 945 ), 946 946 'conpherence-widget-pane-css' => 947 947 array( 948 - 'uri' => '/res/e06804b6/rsrc/css/application/conpherence/widget-pane.css', 948 + 'uri' => '/res/40be33e2/rsrc/css/application/conpherence/widget-pane.css', 949 949 'type' => 'css', 950 950 'requires' => 951 951 array( ··· 1325 1325 ), 1326 1326 'javelin-behavior-conpherence-widget-pane' => 1327 1327 array( 1328 - 'uri' => '/res/3b06849a/rsrc/js/application/conpherence/behavior-widget-pane.js', 1328 + 'uri' => '/res/440f5bdf/rsrc/js/application/conpherence/behavior-widget-pane.js', 1329 1329 'type' => 'js', 1330 1330 'requires' => 1331 1331 array(
+16
src/applications/conpherence/controller/ConpherenceController.php
··· 13 13 pht('New Message'), 14 14 $this->getApplicationURI('new/')); 15 15 16 + $nav->addMenuItem( 17 + id(new PhabricatorMenuItemView()) 18 + ->setName(pht('Add Participants')) 19 + ->setType(PhabricatorMenuItemView::TYPE_LINK) 20 + ->setHref('#') 21 + ->addSigil('conpherence-widget-adder') 22 + ->setMetadata(array('widget' => 'widgets-people'))); 23 + 24 + $nav->addMenuItem( 25 + id(new PhabricatorMenuItemView()) 26 + ->setName(pht('New Calendar Item')) 27 + ->setType(PhabricatorMenuItemView::TYPE_LINK) 28 + ->setHref('/calendar/status/create/') 29 + ->addSigil('conpherence-widget-adder') 30 + ->setMetadata(array('widget' => 'widgets-calendar'))); 31 + 16 32 return $nav; 17 33 } 18 34
+27 -4
src/applications/conpherence/controller/ConpherenceUpdateController.php
··· 54 54 break; 55 55 case ConpherenceUpdateActions::ADD_PERSON: 56 56 $xactions = array(); 57 - $person_tokenizer = $request->getArr('add_person'); 58 - $person_phid = reset($person_tokenizer); 59 - if ($person_phid) { 57 + $person_phids = $request->getArr('add_person'); 58 + if (!empty($person_phids)) { 60 59 $xactions[] = id(new ConpherenceTransaction()) 61 60 ->setTransactionType( 62 61 ConpherenceTransactionType::TYPE_PARTICIPANTS) 63 - ->setNewValue(array('+' => array($person_phid))); 62 + ->setNewValue(array('+' => $person_phids)); 64 63 } 65 64 break; 66 65 case ConpherenceUpdateActions::REMOVE_PERSON: ··· 153 152 } 154 153 155 154 switch ($action) { 155 + case ConpherenceUpdateActions::ADD_PERSON: 156 + $dialogue = $this->renderAddPersonDialogue($conpherence); 157 + break; 156 158 case ConpherenceUpdateActions::REMOVE_PERSON: 157 159 $dialogue = $this->renderRemovePersonDialogue($conpherence); 158 160 break; ··· 171 173 ->addCancelButton($this->getApplicationURI($conpherence->getID().'/'))); 172 174 173 175 } 176 + 177 + private function renderAddPersonDialogue( 178 + ConpherenceThread $conpherence) { 179 + 180 + $request = $this->getRequest(); 181 + $user = $request->getUser(); 182 + $add_person = $request->getStr('add_person'); 183 + 184 + $body = id(new AphrontFormTokenizerControl()) 185 + ->setPlaceholder(pht('Add participants...')) 186 + ->setName('add_person') 187 + ->setUser($user) 188 + ->setDatasource('/typeahead/common/users/') 189 + ->setLimit(1); 190 + 191 + require_celerity_resource('conpherence-update-css'); 192 + return id(new AphrontDialogView()) 193 + ->setTitle(pht('Update Conpherence Participants')) 194 + ->addHiddenInput('action', 'add_person') 195 + ->appendChild($body); 196 + } 174 197 175 198 private function renderRemovePersonDialogue( 176 199 ConpherenceThread $conpherence) {
+1
src/applications/conpherence/controller/ConpherenceWidgetController.php
··· 69 69 ->setSpriteSheet(PHUIIconView::SPRITE_ACTIONS) 70 70 ->setSpriteIcon('new-grey') 71 71 ->setHref($this->getWidgetURI()) 72 + ->setMetadata(array('widget' => null)) 72 73 ->addSigil('conpherence-widget-adder'); 73 74 $widgets[] = phutil_tag( 74 75 'div',
+12 -3
src/applications/conpherence/view/ConpherenceLayoutView.php
··· 77 77 Javelin::initBehavior( 78 78 'conpherence-widget-pane', 79 79 array( 80 - 'selectChar' => "\xE2\x96\xBC", 80 + 'widgetBaseUpdateURI' => $this->baseURI . 'update/', 81 81 'widgetRegistry' => array( 82 82 'conpherence-message-pane' => array( 83 83 'name' => pht('Thread'), ··· 87 87 'widgets-people' => array( 88 88 'name' => pht('Participants'), 89 89 'deviceOnly' => false, 90 - 'hasCreate' => false 90 + 'hasCreate' => true, 91 + 'createData' => array( 92 + 'refreshFromResponse' => true, 93 + 'action' => ConpherenceUpdateActions::ADD_PERSON, 94 + 'customHref' => null 95 + ) 91 96 ), 92 97 'widgets-files' => array( 93 98 'name' => pht('Files'), ··· 98 103 'name' => pht('Calendar'), 99 104 'deviceOnly' => false, 100 105 'hasCreate' => true, 101 - 'createHref' => '/calendar/status/create/' 106 + 'createData' => array( 107 + 'refreshFromResponse' => false, 108 + 'action' => ConpherenceUpdateActions::ADD_STATUS, 109 + 'customHref' => '/calendar/status/create/' 110 + ) 102 111 ), 103 112 'widgets-settings' => array( 104 113 'name' => pht('Settings'),
+1 -41
src/applications/conpherence/view/ConpherencePeopleWidgetView.php
··· 12 12 $participants = $conpherence->getParticipants(); 13 13 $handles = $conpherence->getHandles(); 14 14 15 - // ye olde add people widget 16 - $add_widget = phabricator_form( 17 - $user, 18 - array( 19 - 'method' => 'POST', 20 - 'action' => $this->getUpdateURI(), 21 - 'sigil' => 'add-person', 22 - 'meta' => array( 23 - 'action' => 'add_person' 24 - ) 25 - ), 26 - array( 27 - id(new AphrontFormTokenizerControl()) 28 - ->setPlaceholder(pht('Add a person...')) 29 - ->setName('add_person') 30 - ->setUser($user) 31 - ->setDatasource('/typeahead/common/users/') 32 - ->setLimit(1), 33 - phutil_tag( 34 - 'button', 35 - array( 36 - 'type' => 'submit', 37 - 'class' => 'people-add-button', 38 - ), 39 - pht('Add')) 40 - )); 41 - $header = phutil_tag( 42 - 'div', 43 - array( 44 - 'class' => 'people-widget-header' 45 - ), 46 - array( 47 - phutil_tag( 48 - 'div', 49 - array( 50 - 'class' => 'add-people-widget', 51 - ), 52 - $add_widget) 53 - )); 54 - 55 15 $body = array(); 56 16 // future proof by using participants to iterate through handles; 57 17 // we may have non-people handles sooner or later ··· 97 57 $remove_html)); 98 58 } 99 59 100 - return array($header, $body); 60 + return $body; 101 61 } 102 62 }
+1 -1
webroot/rsrc/css/application/conpherence/widget-pane.css
··· 344 344 345 345 .conpherence-widget-pane .person-entry { 346 346 clear: both; 347 - padding: 5px 0 0 10px; 347 + padding: 10px 0px 0px 10px; 348 348 } 349 349 350 350 .conpherence-widget-pane .person-entry a {
+65 -51
webroot/rsrc/js/application/conpherence/behavior-widget-pane.js
··· 229 229 'conpherence-widget-adder', 230 230 function (e) { 231 231 e.kill(); 232 + 232 233 var widgets = config.widgetRegistry; 233 - var active_widget = null; 234 - var href = null; 234 + // the widget key might be in node data, but otherwise use the 235 + // selected widget 236 + var event_data = e.getNodeData('conpherence-widget-adder'); 237 + var widget_key = _selectedWidgetName; 238 + if (event_data.widget) { 239 + widget_key = widgets[event_data.widget].name; 240 + } 241 + 242 + var widget_to_update = null; 243 + var create_data = null; 235 244 for (var widget in widgets) { 236 - if (widgets[widget].name == _selectedWidgetName) { 237 - href = widgets[widget].createHref; 238 - active_widget = widget; 245 + if (widgets[widget].name == widget_key) { 246 + create_data = widgets[widget].createData; 247 + widget_to_update = widget; 239 248 break; 240 249 } 241 250 } 242 - new JX.Workflow(href, {}) 243 - .setHandler(function () { 244 - JX.Stratcom.invoke( 245 - 'conpherence-reload-widget', 246 - null, 247 - { 248 - threadID : _loadedWidgetsID, 249 - widget : active_widget 250 - } 251 - ); 252 - }) 253 - .start(); 254 - } 255 - ); 251 + // this should be impossible, but hey 252 + if (!widget_to_update) { 253 + return; 254 + } 255 + var href = config.widgetBaseUpdateURI + _loadedWidgetsID + '/'; 256 + if (create_data.customHref) { 257 + href = create_data.customHref; 258 + } 256 259 257 - /* people widget */ 258 - JX.Stratcom.listen( 259 - ['submit', 'didSyntheticSubmit'], 260 - 'add-person', 261 - function (e) { 262 - e.kill(); 263 - var root = e.getNode('conpherence-layout'); 264 - var form = e.getNode('tag:form'); 265 - var data = e.getNodeData('add-person'); 266 - var people_root = e.getNode('widgets-people'); 267 - var messages = null; 268 - try { 269 - messages = JX.DOM.find(root, 'div', 'conpherence-messages'); 270 - } catch (ex) { 271 - } 260 + var root = JX.DOM.find(document, 'div', 'conpherence-layout'); 272 261 var latest_transaction_data = JX.Stratcom.getData( 273 262 JX.DOM.find( 274 263 root, 275 264 'input', 276 265 'latest-transaction-id' 277 266 )); 278 - data.latest_transaction_id = latest_transaction_data.id; 279 - JX.Workflow.newFromForm(form, data) 280 - .setHandler(JX.bind(this, function (r) { 281 - if (messages) { 282 - JX.DOM.appendContent(messages, JX.$H(r.transactions)); 283 - messages.scrollTop = messages.scrollHeight; 284 - } 267 + var data = { 268 + latest_transaction_id : latest_transaction_data.id, 269 + action : create_data.action 270 + }; 285 271 286 - // update the people widget 287 - JX.DOM.setContent( 288 - people_root, 289 - JX.$H(r.people_widget) 290 - ); 291 - })) 292 - .start(); 272 + new JX.Workflow(href, data) 273 + .setHandler(function (r) { 274 + if (create_data.refreshFromResponse) { 275 + var messages = null; 276 + try { 277 + messages = JX.DOM.find(root, 'div', 'conpherence-messages'); 278 + } catch (ex) { 279 + } 280 + if (messages) { 281 + JX.DOM.appendContent(messages, JX.$H(r.transactions)); 282 + messages.scrollTop = messages.scrollHeight; 283 + } 284 + 285 + if (r.people_widget) { 286 + try { 287 + var people_root = JX.DOM.find(root, 'div', 'widgets-people'); 288 + // update the people widget 289 + JX.DOM.setContent( 290 + people_root, 291 + JX.$H(r.people_widget)); 292 + } catch (ex) { 293 + } 294 + } 295 + 296 + // otherwise let's redraw the widget somewhat lazily 297 + } else { 298 + JX.Stratcom.invoke( 299 + 'conpherence-reload-widget', 300 + null, 301 + { 302 + threadID : _loadedWidgetsID, 303 + widget : widget_to_update 304 + }); 305 + } 306 + }) 307 + .start(); 293 308 } 294 309 ); 295 310 ··· 297 312 ['touchstart', 'mousedown'], 298 313 'remove-person', 299 314 function (e) { 300 - var people_root = e.getNode('widgets-people'); 301 - var form = JX.DOM.find(peopleRoot, 'form'); 315 + var href = config.widgetBaseUpdateURI + _loadedWidgetsID + '/'; 302 316 var data = e.getNodeData('remove-person'); 303 317 // we end up re-directing to conpherence home 304 - JX.Workflow.newFromForm(form, data) 318 + new JX.Workflow(href, data) 305 319 .start(); 306 320 } 307 321 );