FIX: Make inline oneboxes work with secured topics in secured contexts (#8895)

This commit is contained in:
Dan Ungureanu
2020-02-12 12:11:28 +02:00
committed by GitHub
parent d7d4612b2d
commit ec40242b5c
8 changed files with 89 additions and 38 deletions

View File

@@ -5,14 +5,20 @@ import {
const _cache = {};
export function applyInlineOneboxes(inline, ajax) {
export function applyInlineOneboxes(inline, ajax, opts) {
opts = opts || {};
Object.keys(inline).forEach(url => {
// cache a blank locally, so we never trigger a lookup
_cache[url] = {};
});
return ajax("/inline-onebox", {
data: { urls: Object.keys(inline) }
data: {
urls: Object.keys(inline),
category_id: opts.categoryId,
topic_id: opts.topicId
}
}).then(result => {
result["inline-oneboxes"].forEach(onebox => {
if (onebox.title) {