mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-28 17:46:16 +01:00
fix: inability to query local content via remote url
This commit is contained in:
@@ -75,7 +75,12 @@ async function searchInContent(data) {
|
|||||||
} else {
|
} else {
|
||||||
let result;
|
let result;
|
||||||
if (data.uid && activitypub.helpers.isUri(data.query)) {
|
if (data.uid && activitypub.helpers.isUri(data.query)) {
|
||||||
result = await fetchRemoteObject(data.uid, data.query);
|
const local = await activitypub.helpers.resolveLocalId(data.query);
|
||||||
|
if (local.type === 'post') {
|
||||||
|
result = [[local.id], []];
|
||||||
|
} else {
|
||||||
|
result = await fetchRemoteObject(data.uid, data.query);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
|
|||||||
@@ -44,11 +44,16 @@ module.exports = function (User) {
|
|||||||
if (!data.findUids && data.uid) {
|
if (!data.findUids && data.uid) {
|
||||||
const handle = activitypub.helpers.isWebfinger(data.query);
|
const handle = activitypub.helpers.isWebfinger(data.query);
|
||||||
if (handle || activitypub.helpers.isUri(data.query)) {
|
if (handle || activitypub.helpers.isUri(data.query)) {
|
||||||
const assertion = await activitypub.actors.assert([handle || data.query]);
|
const local = await activitypub.helpers.resolveLocalId(data.query);
|
||||||
if (assertion === true) {
|
if (local.type === 'user') {
|
||||||
uids = [handle ? await User.getUidByUserslug(handle) : query];
|
uids = [local.id];
|
||||||
} else if (Array.isArray(assertion) && assertion.length) {
|
} else {
|
||||||
uids = assertion.map(u => u.id);
|
const assertion = await activitypub.actors.assert([handle || data.query]);
|
||||||
|
if (assertion === true) {
|
||||||
|
uids = [handle ? await User.getUidByUserslug(handle) : query];
|
||||||
|
} else if (Array.isArray(assertion) && assertion.length) {
|
||||||
|
uids = assertion.map(u => u.id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user