Conpherence - add ability to change title in the durable column
Summary: Ref T7014. Test Plan: changed the conpherence title from the column. since i can't get scrolling to work, i inspect the dom to verify the title change transaction showed up properly Reviewers: epriestley, chad Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T7014 Differential Revision: https://secure.phabricator.com/D12002
This commit is contained in:
		| @@ -44,7 +44,7 @@ return array( | ||||
|     'rsrc/css/application/config/config-welcome.css' => '6abd79be', | ||||
|     'rsrc/css/application/config/setup-issue.css' => '22270af2', | ||||
|     'rsrc/css/application/config/unhandled-exception.css' => '37d4f9a2', | ||||
|     'rsrc/css/application/conpherence/durable-column.css' => '1ef6ae75', | ||||
|     'rsrc/css/application/conpherence/durable-column.css' => '9207426d', | ||||
|     'rsrc/css/application/conpherence/menu.css' => 'c6ac5299', | ||||
|     'rsrc/css/application/conpherence/message-pane.css' => '5930260a', | ||||
|     'rsrc/css/application/conpherence/notification.css' => '04a6e10a', | ||||
| @@ -351,7 +351,7 @@ return array( | ||||
|     'rsrc/js/application/aphlict/behavior-aphlict-status.js' => 'ea681761', | ||||
|     'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18', | ||||
|     'rsrc/js/application/config/behavior-reorder-fields.js' => '14a827de', | ||||
|     'rsrc/js/application/conpherence/behavior-durable-column.js' => 'd32db212', | ||||
|     'rsrc/js/application/conpherence/behavior-durable-column.js' => 'e4affa94', | ||||
|     'rsrc/js/application/conpherence/behavior-menu.js' => '869e3445', | ||||
|     'rsrc/js/application/conpherence/behavior-pontificate.js' => '86df5915', | ||||
|     'rsrc/js/application/conpherence/behavior-widget-pane.js' => '40b1ff90', | ||||
| @@ -512,7 +512,7 @@ return array( | ||||
|     'changeset-view-manager' => 'a9af1212', | ||||
|     'config-options-css' => '7fedf08b', | ||||
|     'config-welcome-css' => '6abd79be', | ||||
|     'conpherence-durable-column-view' => '1ef6ae75', | ||||
|     'conpherence-durable-column-view' => '9207426d', | ||||
|     'conpherence-menu-css' => 'c6ac5299', | ||||
|     'conpherence-message-pane-css' => '5930260a', | ||||
|     'conpherence-notification-css' => '04a6e10a', | ||||
| @@ -582,7 +582,7 @@ return array( | ||||
|     'javelin-behavior-diffusion-locate-file' => '6d3e1947', | ||||
|     'javelin-behavior-diffusion-pull-lastmodified' => '2b228192', | ||||
|     'javelin-behavior-doorkeeper-tag' => 'e5822781', | ||||
|     'javelin-behavior-durable-column' => 'd32db212', | ||||
|     'javelin-behavior-durable-column' => 'e4affa94', | ||||
|     'javelin-behavior-error-log' => '6882e80a', | ||||
|     'javelin-behavior-fancy-datepicker' => 'c51ae228', | ||||
|     'javelin-behavior-global-drag-and-drop' => '07f199d8', | ||||
| @@ -1756,14 +1756,6 @@ return array( | ||||
|     'd254d646' => array( | ||||
|       'javelin-util', | ||||
|     ), | ||||
|     'd32db212' => array( | ||||
|       'javelin-behavior', | ||||
|       'javelin-dom', | ||||
|       'javelin-stratcom', | ||||
|       'javelin-scrollbar', | ||||
|       'javelin-quicksand', | ||||
|       'phabricator-keyboard-shortcut', | ||||
|     ), | ||||
|     'd3aa4b40' => array( | ||||
|       'javelin-dom', | ||||
|       'javelin-util', | ||||
| @@ -1844,6 +1836,14 @@ return array( | ||||
|       'javelin-dom', | ||||
|       'javelin-uri', | ||||
|     ), | ||||
|     'e4affa94' => array( | ||||
|       'javelin-behavior', | ||||
|       'javelin-dom', | ||||
|       'javelin-stratcom', | ||||
|       'javelin-scrollbar', | ||||
|       'javelin-quicksand', | ||||
|       'phabricator-keyboard-shortcut', | ||||
|     ), | ||||
|     'e4cc26b3' => array( | ||||
|       'javelin-behavior', | ||||
|       'javelin-dom', | ||||
|   | ||||
| @@ -62,11 +62,7 @@ abstract class ConpherenceController extends PhabricatorController { | ||||
|  | ||||
|   protected function buildHeaderPaneContent(ConpherenceThread $conpherence) { | ||||
|     $crumbs = $this->buildApplicationCrumbs(); | ||||
|     if ($conpherence->getTitle()) { | ||||
|       $title = $conpherence->getTitle(); | ||||
|     } else { | ||||
|       $title = pht('[No Title]'); | ||||
|     } | ||||
|     $title = $this->getConpherenceTitle($conpherence); | ||||
|     $crumbs->addCrumb( | ||||
|       id(new PHUICrumbView()) | ||||
|       ->setName($title) | ||||
| @@ -85,4 +81,14 @@ abstract class ConpherenceController extends PhabricatorController { | ||||
|         $crumbs, | ||||
|       )); | ||||
|   } | ||||
|  | ||||
|   protected function getConpherenceTitle(ConpherenceThread $conpherence) { | ||||
|     if ($conpherence->getTitle()) { | ||||
|       $title = $conpherence->getTitle(); | ||||
|     } else { | ||||
|       $title = pht('[No Title]'); | ||||
|     } | ||||
|     return $title; | ||||
|   } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -108,7 +108,9 @@ final class ConpherenceUpdateController | ||||
|               ->setTransactionType(ConpherenceTransactionType::TYPE_TITLE) | ||||
|               ->setNewValue($title); | ||||
|             $updated = true; | ||||
|             $response_mode = 'redirect'; | ||||
|             if (!$request->getExists('force_ajax')) { | ||||
|               $response_mode = 'redirect'; | ||||
|             } | ||||
|           } | ||||
|           if (!$updated) { | ||||
|             $errors[] = pht( | ||||
| @@ -271,7 +273,7 @@ final class ConpherenceUpdateController | ||||
|         ->setValue($conpherence->getTitle())); | ||||
|  | ||||
|     require_celerity_resource('conpherence-update-css'); | ||||
|     return id(new AphrontDialogView()) | ||||
|     $view = id(new AphrontDialogView()) | ||||
|       ->setTitle(pht('Update Conpherence')) | ||||
|       ->addHiddenInput('action', 'metadata') | ||||
|       ->addHiddenInput( | ||||
| @@ -279,6 +281,15 @@ final class ConpherenceUpdateController | ||||
|         $request->getInt('latest_transaction_id')) | ||||
|       ->addHiddenInput('__continue__', true) | ||||
|       ->appendChild($form); | ||||
|  | ||||
|     if ($request->getExists('minimal_display')) { | ||||
|       $view->addHiddenInput('minimal_display', true); | ||||
|     } | ||||
|     if ($request->getExists('force_ajax')) { | ||||
|       $view->addHiddenInput('force_ajax', true); | ||||
|     } | ||||
|  | ||||
|     return $view; | ||||
|   } | ||||
|  | ||||
|   private function loadAndRenderUpdates( | ||||
| @@ -361,8 +372,10 @@ final class ConpherenceUpdateController | ||||
|     if ($people_widget) { | ||||
|       $people_html = hsprintf('%s', $people_widget->render()); | ||||
|     } | ||||
|     $title = $this->getConpherenceTitle($conpherence); | ||||
|     $content = array( | ||||
|       'transactions' => hsprintf('%s', $rendered_transactions), | ||||
|       'conpherence_title' => (string) $title, | ||||
|       'latest_transaction_id' => $new_latest_transaction_id, | ||||
|       'nav_item' => hsprintf('%s', $nav_item), | ||||
|       'conpherence_phid' => $conpherence->getPHID(), | ||||
|   | ||||
| @@ -54,10 +54,7 @@ final class ConpherenceViewController extends | ||||
|       ); | ||||
|     } | ||||
|  | ||||
|     $title = $conpherence->getTitle(); | ||||
|     if (!$title) { | ||||
|       $title = pht('[No Title]'); | ||||
|     } | ||||
|     $title = $this->getConpherenceTitle($conpherence); | ||||
|     $content['title'] = $title; | ||||
|  | ||||
|     if ($request->isAjax()) { | ||||
|   | ||||
| @@ -205,9 +205,10 @@ final class ConpherenceDurableColumnView extends AphrontTagView { | ||||
|           'class' => 'conpherence-durable-column-header', | ||||
|         ), | ||||
|         array( | ||||
|           phutil_tag( | ||||
|           javelin_tag( | ||||
|             'div', | ||||
|             array( | ||||
|               'sigil' => 'conpherence-durable-column-header-text', | ||||
|               'class' => 'conpherence-durable-column-header-text', | ||||
|             ), | ||||
|             $title), | ||||
| @@ -224,6 +225,12 @@ final class ConpherenceDurableColumnView extends AphrontTagView { | ||||
|         'icon' => 'fa-plus', | ||||
|         'key' => ConpherenceUpdateActions::ADD_PERSON, | ||||
|       ), | ||||
|       array( | ||||
|         'name' => pht('Rename Thread'), | ||||
|         'href' => '/conpherence/update/'.$conpherence->getID().'/', | ||||
|         'icon' => 'fa-pencil', | ||||
|         'key' => ConpherenceUpdateActions::METADATA, | ||||
|       ), | ||||
|       array( | ||||
|         'name' => pht('View in Conpherence'), | ||||
|         'href' => '/conpherence/'.$conpherence->getID().'/', | ||||
|   | ||||
| @@ -50,6 +50,7 @@ | ||||
|  | ||||
| .conpherence-durable-column-header-text:hover { | ||||
|   color: #fff; | ||||
|   text-decoration: none; | ||||
| } | ||||
|  | ||||
| .conpherence-durable-column-icon-bar { | ||||
|   | ||||
| @@ -90,7 +90,7 @@ JX.behavior('durable-column', function() { | ||||
|       knownID: latestTransactionID | ||||
|     }; | ||||
|     workflow.listen('finally', function() { | ||||
|       var need_sync = (updating.knownID > latestTransactionID); | ||||
|       var need_sync = (updating && updating.knownID > latestTransactionID); | ||||
|       updating = null; | ||||
|       if (need_sync) { | ||||
|         update_thread(); | ||||
| @@ -134,11 +134,43 @@ JX.behavior('durable-column', function() { | ||||
|       var data = e.getNodeData('conpherence-durable-column-header-action'); | ||||
|       var action = data.action; | ||||
|       var link = e.getNode('tag:a'); | ||||
|       var params = null; | ||||
|  | ||||
|       switch (action) { | ||||
|         case 'metadata': | ||||
|           JX.Stratcom.invoke('notification-panel-close'); | ||||
|           params = { | ||||
|             action: action, | ||||
|             latest_transaction_id: latestTransactionID, | ||||
|             minimal_display: true, | ||||
|             force_ajax: true | ||||
|           }; | ||||
|           var workflow = new JX.Workflow.newFromLink(link) | ||||
|             .setData(params) | ||||
|             .setHandler(function(r) { | ||||
|               var messages = _getColumnMessagesNode(); | ||||
|               JX.DOM.appendContent(messages, JX.$H(r.transactions)); | ||||
|               messages.scrollTop = messages.scrollHeight; | ||||
|  | ||||
|               var title = _getColumnTitleNode(); | ||||
|               JX.DOM.setContent(title, r.conpherence_title); | ||||
|  | ||||
|               latestTransactionID = r.latest_transaction_id; | ||||
|               // since this is a two step workflow, and the "finally" method | ||||
|               // gets called on the first form load, restore "updating" if | ||||
|               // necessary | ||||
|               if (updating === null) { | ||||
|                 updating = { | ||||
|                   threadPHID: loadedThreadPHID, | ||||
|                   knownID: latestTransactionID | ||||
|                 }; | ||||
|               } | ||||
|             }); | ||||
|           sync_workflow(workflow); | ||||
|           break; | ||||
|         case 'add_person': | ||||
|           JX.Stratcom.invoke('notification-panel-close'); | ||||
|           var params = { | ||||
|           params = { | ||||
|             action: action, | ||||
|             latest_transaction_id: latestTransactionID, | ||||
|             minimal_display: true | ||||
| @@ -193,6 +225,14 @@ JX.behavior('durable-column', function() { | ||||
|       'conpherence-durable-column-transactions'); | ||||
|   } | ||||
|  | ||||
|   function _getColumnTitleNode() { | ||||
|     var column = JX.$('conpherence-durable-column'); | ||||
|     return JX.DOM.find( | ||||
|       column, | ||||
|       'div', | ||||
|       'conpherence-durable-column-header-text'); | ||||
|   } | ||||
|  | ||||
|   function _getColumnFormNode() { | ||||
|     var column = JX.$('conpherence-durable-column'); | ||||
|     return JX.DOM.find( | ||||
| @@ -231,7 +271,6 @@ JX.behavior('durable-column', function() { | ||||
|     // We can pick a thread from the server the first time | ||||
|     if (shouldInit) { | ||||
|       shouldInit = false; | ||||
|       params = { shouldInit : true }; | ||||
|     } else { | ||||
|       params = { id : thread_id }; | ||||
|     } | ||||
| @@ -282,9 +321,9 @@ JX.behavior('durable-column', function() { | ||||
|   } | ||||
|  | ||||
|   JX.Stratcom.listen( | ||||
|       'click', | ||||
|       'conpherence-send-message', | ||||
|       _sendMessage); | ||||
|     'click', | ||||
|     'conpherence-send-message', | ||||
|     _sendMessage); | ||||
|  | ||||
|   JX.Stratcom.listen( | ||||
|     ['submit', 'didSyntheticSubmit'], | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Bob Trahan
					Bob Trahan