mirror of
https://github.com/discourse/discourse.git
synced 2024-12-14 03:43:45 +08:00
Merge diffs from master
This commit is contained in:
parent
607d00f780
commit
eb10109c99
|
@ -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();
|
||||
}
|
||||
});
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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="<h1 id='find-me'>hello</h1>" 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"
|
||||
);
|
||||
}
|
||||
});
|
Loading…
Reference in New Issue
Block a user