From e6833b642756f55a8cdd950dac2718e9865ca68f Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Wed, 11 Apr 2018 11:39:48 -0700 Subject: [PATCH] cleanup: Remove the legacy Dropbox file upload integration. This has been hard-disabled for years, we have no plans to re-enable it, and it has some hacky code in it. --- .eslintrc.json | 1 - static/js/compose.js | 34 ---------------------------------- static/js/feature_flags.js | 1 - templates/zerver/base.html | 4 ---- templates/zerver/compose.html | 2 -- zerver/context_processors.py | 6 ------ zproject/settings.py | 1 - 7 files changed, 49 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 5b2a9a5bc0..2e583ec8ed 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -15,7 +15,6 @@ "XDate": false, "zxcvbn": false, "LazyLoad": false, - "Dropbox": false, "SockJS": false, "marked": false, "md5": false, diff --git a/static/js/compose.js b/static/js/compose.js index be65a16649..6d4e8987ce 100644 --- a/static/js/compose.js +++ b/static/js/compose.js @@ -705,22 +705,6 @@ exports.initialize = function () { upload.feature_check($("#compose #attach_files")); - // Lazy load the Dropbox script, since it can slow our page load - // otherwise, and isn't enabled for all users. Also, this Dropbox - // script isn't under an open source license, so we can't (for legal - // reasons) minify it with our own code. - if (feature_flags.dropbox_integration) { - LazyLoad.js('https://www.dropbox.com/static/api/1/dropins.js', function () { - // Successful load. We should now have window.Dropbox. - if (! _.has(window, 'Dropbox')) { - blueslip.error('Dropbox script reports loading but window.Dropbox undefined'); - } else if (Dropbox.isBrowserSupported()) { - Dropbox.init({appKey: window.dropboxAppKey}); - $("#compose #attach_dropbox_files").removeClass("notdisplayed"); - } - }); - } - // Show a warning if a user @-mentions someone who will not receive this message $(document).on('usermention_completed.zulip', function (event, data) { if (compose_state.get_message_type() !== 'stream') { @@ -998,24 +982,6 @@ exports.initialize = function () { exports.clear_preview_area(); }); - $("#compose").on("click", "#attach_dropbox_files", function (e) { - e.preventDefault(); - var options = { - // Required. Called when a user selects an item in the Chooser. - success: function (files) { - var textbox = $("#compose-textarea"); - var links = _.map(files, function (file) { return '[' + file.name + '](' + file.link +')'; }) - .join(' ') + ' '; - textbox.val(textbox.val() + links); - }, - // Optional. A value of false (default) limits selection to a single file, while - // true enables multiple file selection. - multiselect: true, - iframe: true, - }; - Dropbox.choose(options); - }); - $("#compose").filedrop( upload.options({ mode: 'compose', diff --git a/static/js/feature_flags.js b/static/js/feature_flags.js index a331f9a5d5..87ef094299 100644 --- a/static/js/feature_flags.js +++ b/static/js/feature_flags.js @@ -13,7 +13,6 @@ exports.mark_read_at_bottom = true; exports.propagate_topic_edits = true; exports.clicking_notification_causes_narrow = true; exports.collapsible = false; -exports.dropbox_integration = false; exports.reminders_in_message_action_menu = false; return exports; diff --git a/templates/zerver/base.html b/templates/zerver/base.html index f528b2a609..f917dbfee8 100644 --- a/templates/zerver/base.html +++ b/templates/zerver/base.html @@ -15,10 +15,6 @@ - {% if dropboxAppKey %} - - {% endif %} - {# We need to import jQuery before Bootstrap #} {% stylesheet 'common' %} {% block page_params %} diff --git a/templates/zerver/compose.html b/templates/zerver/compose.html index 2205ffc711..e3aedfe21a 100644 --- a/templates/zerver/compose.html +++ b/templates/zerver/compose.html @@ -106,8 +106,6 @@ id="emoji_map" href="#" title="{{ _('Add emoji') }}"> - {% if jitsi_server_url %} diff --git a/zerver/context_processors.py b/zerver/context_processors.py index 8f17efed45..da5dcdc356 100644 --- a/zerver/context_processors.py +++ b/zerver/context_processors.py @@ -136,9 +136,3 @@ def zulip_default_context(request: HttpRequest) -> Dict[str, Any]: 'settings_comments_path': settings_comments_path, 'platform': platform, } - - -def add_metrics(request: HttpRequest) -> Dict[str, str]: - return { - 'dropboxAppKey': settings.DROPBOX_APP_KEY - } diff --git a/zproject/settings.py b/zproject/settings.py index 2552dc1757..e61356bd09 100644 --- a/zproject/settings.py +++ b/zproject/settings.py @@ -1232,7 +1232,6 @@ base_template_engine_settings = { ], 'context_processors': [ 'zerver.context_processors.zulip_default_context', - 'zerver.context_processors.add_metrics', 'django.template.context_processors.i18n', ], },