From 167eb9a25692d0fa4d02c966621aa1f9c23da639 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Thu, 20 Aug 2015 08:24:42 -0700 Subject: [PATCH] Remove Files Widget from Conpherence Summary: Fixes T8834. Removes everywhere I could find references to Files. Test Plan: Use Conpherence, send a message, attach a file, try durable column, send message, send file. Seems snappy. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T8834 Differential Revision: https://secure.phabricator.com/D13936 --- resources/celerity/map.php | 36 ++++----- src/__phutil_library_map__.php | 2 - .../ConpherenceWidgetConfigConstants.php | 6 -- .../ConpherenceUpdateController.php | 7 -- .../ConpherenceWidgetController.php | 18 ----- .../view/ConpherenceFileWidgetView.php | 76 ------------------- .../application/conpherence/widget-pane.css | 63 --------------- .../application/conpherence/behavior-menu.js | 12 --- 8 files changed, 18 insertions(+), 202 deletions(-) delete mode 100644 src/applications/conpherence/view/ConpherenceFileWidgetView.php diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 6b7b0e4194..115c6ff699 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -51,7 +51,7 @@ return array( 'rsrc/css/application/conpherence/notification.css' => '6cdcc253', 'rsrc/css/application/conpherence/transaction.css' => '85d0974c', 'rsrc/css/application/conpherence/update.css' => 'faf6be09', - 'rsrc/css/application/conpherence/widget-pane.css' => 'b0793769', + 'rsrc/css/application/conpherence/widget-pane.css' => '775eaaba', 'rsrc/css/application/contentsource/content-source-view.css' => '4b8b05d4', 'rsrc/css/application/countdown/timer.css' => 'e7544472', 'rsrc/css/application/daemon/bulk-job.css' => 'df9c1d4a', @@ -346,7 +346,7 @@ return array( 'rsrc/js/application/conpherence/ConpherenceThreadManager.js' => '01774ab2', 'rsrc/js/application/conpherence/behavior-drag-and-drop-photo.js' => 'cf86d16a', 'rsrc/js/application/conpherence/behavior-durable-column.js' => 'c72aa091', - 'rsrc/js/application/conpherence/behavior-menu.js' => 'd3782c93', + 'rsrc/js/application/conpherence/behavior-menu.js' => '1d45c74d', 'rsrc/js/application/conpherence/behavior-pontificate.js' => '21ba5861', 'rsrc/js/application/conpherence/behavior-quicksand-blacklist.js' => '7927a7d3', 'rsrc/js/application/conpherence/behavior-widget-pane.js' => 'a8458711', @@ -514,7 +514,7 @@ return array( 'conpherence-thread-manager' => '01774ab2', 'conpherence-transaction-css' => '85d0974c', 'conpherence-update-css' => 'faf6be09', - 'conpherence-widget-pane-css' => 'b0793769', + 'conpherence-widget-pane-css' => '775eaaba', 'differential-changeset-view-css' => 'b6b0d1bb', 'differential-core-view-css' => '7ac3cabc', 'differential-inline-comment-editor' => 'd4c87bf4', @@ -552,7 +552,7 @@ return array( 'javelin-behavior-choose-control' => '6153c708', 'javelin-behavior-config-reorder-fields' => 'b6993408', 'javelin-behavior-conpherence-drag-and-drop-photo' => 'cf86d16a', - 'javelin-behavior-conpherence-menu' => 'd3782c93', + 'javelin-behavior-conpherence-menu' => '1d45c74d', 'javelin-behavior-conpherence-pontificate' => '21ba5861', 'javelin-behavior-conpherence-widget-pane' => 'a8458711', 'javelin-behavior-countdown-timer' => 'e4cc26b3', @@ -955,6 +955,20 @@ return array( 'javelin-dom', 'javelin-vector', ), + '1d45c74d' => array( + 'javelin-behavior', + 'javelin-dom', + 'javelin-util', + 'javelin-stratcom', + 'javelin-workflow', + 'javelin-behavior-device', + 'javelin-history', + 'javelin-vector', + 'javelin-scrollbar', + 'phabricator-title', + 'phabricator-shaped-request', + 'conpherence-thread-manager', + ), '1def2711' => array( 'javelin-install', 'javelin-dom', @@ -1798,20 +1812,6 @@ return array( 'd254d646' => array( 'javelin-util', ), - 'd3782c93' => array( - 'javelin-behavior', - 'javelin-dom', - 'javelin-util', - 'javelin-stratcom', - 'javelin-workflow', - 'javelin-behavior-device', - 'javelin-history', - 'javelin-vector', - 'javelin-scrollbar', - 'phabricator-title', - 'phabricator-shaped-request', - 'conpherence-thread-manager', - ), 'd4505101' => array( 'javelin-stratcom', 'javelin-install', diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 3023eceaed..d7f747ca13 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -232,7 +232,6 @@ phutil_register_library_map(array( 'ConpherenceDAO' => 'applications/conpherence/storage/ConpherenceDAO.php', 'ConpherenceDurableColumnView' => 'applications/conpherence/view/ConpherenceDurableColumnView.php', 'ConpherenceEditor' => 'applications/conpherence/editor/ConpherenceEditor.php', - 'ConpherenceFileWidgetView' => 'applications/conpherence/view/ConpherenceFileWidgetView.php', 'ConpherenceFormDragAndDropUploadControl' => 'applications/conpherence/view/ConpherenceFormDragAndDropUploadControl.php', 'ConpherenceFulltextQuery' => 'applications/conpherence/query/ConpherenceFulltextQuery.php', 'ConpherenceHovercardEventListener' => 'applications/conpherence/events/ConpherenceHovercardEventListener.php', @@ -3853,7 +3852,6 @@ phutil_register_library_map(array( 'ConpherenceDAO' => 'PhabricatorLiskDAO', 'ConpherenceDurableColumnView' => 'AphrontTagView', 'ConpherenceEditor' => 'PhabricatorApplicationTransactionEditor', - 'ConpherenceFileWidgetView' => 'ConpherenceWidgetView', 'ConpherenceFormDragAndDropUploadControl' => 'AphrontFormControl', 'ConpherenceFulltextQuery' => 'PhabricatorOffsetPagedQuery', 'ConpherenceHovercardEventListener' => 'PhabricatorEventListener', diff --git a/src/applications/conpherence/constants/ConpherenceWidgetConfigConstants.php b/src/applications/conpherence/constants/ConpherenceWidgetConfigConstants.php index 9de4420e75..36d4f7d617 100644 --- a/src/applications/conpherence/constants/ConpherenceWidgetConfigConstants.php +++ b/src/applications/conpherence/constants/ConpherenceWidgetConfigConstants.php @@ -30,12 +30,6 @@ final class ConpherenceWidgetConfigConstants extends ConpherenceConstants { 'customHref' => null, ), ), - 'widgets-files' => array( - 'name' => pht('Files'), - 'icon' => 'fa-files-o', - 'deviceOnly' => false, - 'hasCreate' => false, - ), 'widgets-settings' => array( 'name' => pht('Notifications'), 'icon' => 'fa-wrench', diff --git a/src/applications/conpherence/controller/ConpherenceUpdateController.php b/src/applications/conpherence/controller/ConpherenceUpdateController.php index 0739c4054c..6012c81437 100644 --- a/src/applications/conpherence/controller/ConpherenceUpdateController.php +++ b/src/applications/conpherence/controller/ConpherenceUpdateController.php @@ -524,13 +524,6 @@ final class ConpherenceUpdateController ->renderSingleThread($conpherence, $policy_objects); $nav_item = hsprintf('%s', $nav_item); break; - case ConpherenceUpdateActions::MESSAGE: - $file_widget = id(new ConpherenceFileWidgetView()) - ->setUser($this->getRequest()->getUser()) - ->setConpherence($conpherence) - ->setUpdateURI($widget_uri); - $file_widget = hsprintf('%s', $file_widget->render()); - break; case ConpherenceUpdateActions::ADD_PERSON: $people_widget = id(new ConpherencePeopleWidgetView()) ->setUser($user) diff --git a/src/applications/conpherence/controller/ConpherenceWidgetController.php b/src/applications/conpherence/controller/ConpherenceWidgetController.php index 34fa20dee6..0408896a16 100644 --- a/src/applications/conpherence/controller/ConpherenceWidgetController.php +++ b/src/applications/conpherence/controller/ConpherenceWidgetController.php @@ -41,9 +41,6 @@ final class ConpherenceWidgetController extends ConpherenceController { case 'widgets-people': $content = $this->renderPeopleWidgetPaneContent(); break; - case 'widgets-files': - $content = $this->renderFileWidgetPaneContent(); - break; case 'widgets-settings': $content = $this->renderSettingsWidgetPaneContent(); break; @@ -90,15 +87,6 @@ final class ConpherenceWidgetController extends ConpherenceController { 'sigil' => 'widgets-people', ), $this->renderPeopleWidgetPaneContent()); - $widgets[] = javelin_tag( - 'div', - array( - 'class' => 'widgets-body', - 'id' => 'widgets-files', - 'sigil' => 'widgets-files', - 'style' => 'display: none;', - ), - $this->renderFileWidgetPaneContent()); $widgets[] = phutil_tag( 'div', array( @@ -127,12 +115,6 @@ final class ConpherenceWidgetController extends ConpherenceController { ->setUpdateURI($this->getWidgetURI()); } - private function renderFileWidgetPaneContent() { - return id(new ConpherenceFileWidgetView()) - ->setUser($this->getViewer()) - ->setConpherence($this->getConpherence()) - ->setUpdateURI($this->getWidgetURI()); - } private function renderSettingsWidgetPaneContent() { $viewer = $this->getViewer(); diff --git a/src/applications/conpherence/view/ConpherenceFileWidgetView.php b/src/applications/conpherence/view/ConpherenceFileWidgetView.php deleted file mode 100644 index 3cfb8072e3..0000000000 --- a/src/applications/conpherence/view/ConpherenceFileWidgetView.php +++ /dev/null @@ -1,76 +0,0 @@ -getConpherence(); - $widget_data = $conpherence->getWidgetData(); - $files = $widget_data['files']; - $files_authors = $widget_data['files_authors']; - $files_html = array(); - - foreach ($files as $file) { - $icon_class = $file->getDisplayIconForMimeType(); - $icon_view = phutil_tag( - 'div', - array( - 'class' => 'file-icon phui-font-fa phui-icon-view '.$icon_class, - ), - ''); - $file_view = id(new PhabricatorFileLinkView()) - ->setFilePHID($file->getPHID()) - ->setFileName(id(new PhutilUTF8StringTruncator()) - ->setMaximumGlyphs(28) - ->truncateString($file->getName())) - ->setFileViewable($file->isViewableImage()) - ->setFileViewURI($file->getBestURI()) - ->setCustomClass('file-title'); - - $who_done_it_text = ''; - // system generated files don't have authors - if ($file->getAuthorPHID()) { - $who_done_it_text = pht( - 'By %s ', - $files_authors[$file->getPHID()]->renderLink()); - } - $date_text = phabricator_relative_date( - $file->getDateCreated(), - $this->getUser()); - - $who_done_it = phutil_tag( - 'div', - array( - 'class' => 'file-uploaded-by', - ), - pht('%s%s.', $who_done_it_text, $date_text)); - - $files_html[] = phutil_tag( - 'div', - array( - 'class' => 'file-entry', - ), - array( - $icon_view, - $file_view, - $who_done_it, - )); - } - - if (empty($files)) { - $files_html[] = javelin_tag( - 'div', - array( - 'class' => 'no-files', - 'sigil' => 'no-files', - ), - pht('No files.')); - } - - return phutil_tag( - 'div', - array('class' => 'file-list'), - $files_html); - - } - -} diff --git a/webroot/rsrc/css/application/conpherence/widget-pane.css b/webroot/rsrc/css/application/conpherence/widget-pane.css index f4f3449dc3..6b5401b2a9 100644 --- a/webroot/rsrc/css/application/conpherence/widget-pane.css +++ b/webroot/rsrc/css/application/conpherence/widget-pane.css @@ -95,69 +95,6 @@ top: 142px; } -/* files widget */ - -.conpherence-widget-pane #widgets-files .no-files { - width: 200px; - padding: 20px; - text-align: center; - color: {$greytext}; -} - -.device .conpherence-widget-pane #widgets-files .no-files { - width: 60px; - margin: 0 auto 0 auto; -} - -.conpherence-widget-pane #widgets-files .file-entry { - padding: 8px 0; - margin: 0 4px 0 8px; - border-bottom: 1px solid {$thinblueborder}; -} - -.conpherence-widget-pane #widgets-files .file-entry a { - color: {$darkbluetext}; - font-weight: bold; -} - -.conpherence-widget-pane #widgets-files .file-icon { - width: 32px; - height: 32px; - float: left; - font-size: 24px; - color: {$blue}; - margin: 2px 0 2px 4px; -} - -.conpherence-widget-pane #widgets-files .file-title { - display: block; - position: relative; - top: -4px; - left: 0; - overflow-x: hidden; - width: 180px; - font-weight: bold; - text-overflow: ellipsis; - white-space: nowrap; -} -.conpherence-widget-pane #widgets-files .file-uploaded-by { - color: {$lightgreytext}; - position: relative; - top: 0; - left: 0; - width: 180px; - font-size: {$smallestfontsize}; -} - -.device .conpherence-widget-pane #widgets-files .file-title, -.device .conpherence-widget-pane #widgets-files .file-uploaded-by { - width: 82%; -} -.device .conpherence-widget-pane #widgets-files .divider { - width: 80%; - margin: 8px 0px 0px 10%; -} - .conpherence-widget-pane .widget-icon { display: block; height: 14px; diff --git a/webroot/rsrc/js/application/conpherence/behavior-menu.js b/webroot/rsrc/js/application/conpherence/behavior-menu.js index 4d18c44b51..5b93815716 100644 --- a/webroot/rsrc/js/application/conpherence/behavior-menu.js +++ b/webroot/rsrc/js/application/conpherence/behavior-menu.js @@ -66,18 +66,6 @@ JX.behavior('conpherence-menu', function(config) { var form_root = JX.DOM.find(root, 'div', 'conpherence-form'); var textarea = JX.DOM.find(form_root, 'textarea'); if (!non_update) { - var fileWidget = null; - try { - fileWidget = JX.DOM.find(root, 'div', 'widgets-files'); - } catch (ex) { - // Ignore; maybe no files widget - } - if (fileWidget) { - JX.DOM.setContent( - fileWidget, - JX.$H(r.file_widget)); - } - _scrollMessageWindow(); textarea.value = ''; }