From eb10109c997bfb6ca6a560fa535dbcf4a150c930 Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Wed, 24 Jun 2020 13:48:37 -0400 Subject: [PATCH] Merge diffs from master --- .../discourse/components/iframed-html.js.es6 | 18 --------------- app/controllers/uploads_controller.rb | 6 ----- app/models/topic_list.rb | 2 +- lib/topic_query.rb | 23 ------------------- spec/requests/uploads_controller_spec.rb | 11 --------- .../components/iframed-html-test.js.es6 | 23 ------------------- 6 files changed, 1 insertion(+), 82 deletions(-) delete mode 100644 app/assets/javascripts/discourse/components/iframed-html.js.es6 delete mode 100644 test/javascripts/components/iframed-html-test.js.es6 diff --git a/app/assets/javascripts/discourse/components/iframed-html.js.es6 b/app/assets/javascripts/discourse/components/iframed-html.js.es6 deleted file mode 100644 index f05b5d278b8..00000000000 --- a/app/assets/javascripts/discourse/components/iframed-html.js.es6 +++ /dev/null @@ -1,18 +0,0 @@ -import Component from "@ember/component"; - -export default Component.extend({ - tagName: "iframe", - html: null, - className: "", - classNameBindings: ["html:iframed-html", "className"], - sandbox: "allow-same-origin", - attributeBindings: ["sandbox:sandbox"], - - didRender() { - this._super(...arguments); - const iframeDoc = this.element.contentWindow.document; - iframeDoc.open("text/html", "replace"); - iframeDoc.write(this.html); - iframeDoc.close(); - } -}); diff --git a/app/controllers/uploads_controller.rb b/app/controllers/uploads_controller.rb index 2c64cbed0e7..64fcd795b58 100644 --- a/app/controllers/uploads_controller.rb +++ b/app/controllers/uploads_controller.rb @@ -162,12 +162,6 @@ class UploadsController < ApplicationController return redirect_to Discourse.store.url_for(upload) end - # url_for figures out the full URL, handling multisite DBs, - # and will return a presigned URL for the upload - if path_with_ext.blank? - return redirect_to Discourse.store.url_for(upload) - end - redirect_to Discourse.store.signed_url_for_path(path_with_ext) end diff --git a/app/models/topic_list.rb b/app/models/topic_list.rb index d51c0f153f3..52b0ee00708 100644 --- a/app/models/topic_list.rb +++ b/app/models/topic_list.rb @@ -67,7 +67,7 @@ class TopicList def preload_key if @category - "topic_list_#{@category.url.sub(/^\//, '')}/#{@category.id}/l/#{@filter}" + "topic_list_#{@category.url.sub(/^\//, '')}/l/#{@filter}" else "topic_list_#{@filter}" end diff --git a/lib/topic_query.rb b/lib/topic_query.rb index cbfa2ed999b..5f8658661b4 100644 --- a/lib/topic_query.rb +++ b/lib/topic_query.rb @@ -1059,29 +1059,6 @@ class TopicQuery private - def subcategory_ids(category_id) - @subcategory_ids ||= {} - @subcategory_ids[category_id] ||= - begin - sql = <<~SQL - WITH RECURSIVE subcategories AS ( - SELECT :category_id id, 1 depth - UNION - SELECT categories.id, (subcategories.depth + 1) depth - FROM categories - JOIN subcategories ON subcategories.id = categories.parent_category_id - WHERE subcategories.depth < :max_category_nesting - ) - SELECT id FROM subcategories - SQL - DB.query_single( - sql, - category_id: category_id, - max_category_nesting: SiteSetting.max_category_nesting - ) - end - end - def sanitize_sql_array(input) ActiveRecord::Base.public_send(:sanitize_sql_array, input.join(',')) end diff --git a/spec/requests/uploads_controller_spec.rb b/spec/requests/uploads_controller_spec.rb index 7f37c75e16e..0be31c1811f 100644 --- a/spec/requests/uploads_controller_spec.rb +++ b/spec/requests/uploads_controller_spec.rb @@ -417,17 +417,6 @@ describe UploadsController do get upload.short_path expect(response.code).to eq("403") end - - context "when running on a multisite connection" do - before do - Rails.configuration.multisite = true - end - it "redirects to the signed_url_for_path with the multisite DB name in the url" do - freeze_time - get upload.short_path - expect(response.body).to include(RailsMultisite::ConnectionManagement.current_db) - end - end end end end diff --git a/test/javascripts/components/iframed-html-test.js.es6 b/test/javascripts/components/iframed-html-test.js.es6 deleted file mode 100644 index ad7d4113f49..00000000000 --- a/test/javascripts/components/iframed-html-test.js.es6 +++ /dev/null @@ -1,23 +0,0 @@ -import componentTest from "helpers/component-test"; - -moduleForComponent("iframed-html", { integration: true }); - -componentTest("appends the html into the iframe", { - template: `{{iframed-html html="

hello

" className='this-is-an-iframe'}}`, - - async test(assert) { - const iframe = find("iframe.this-is-an-iframe"); - assert.equal(iframe.length, 1, "inserts an iframe"); - - assert.ok( - iframe[0].classList.contains("this-is-an-iframe"), - "Adds className to the iframes classList" - ); - - assert.equal( - iframe[0].contentWindow.document.body.querySelectorAll("#find-me").length, - 1, - "inserts the passed in html into the iframe" - ); - } -});