mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 00:56:13 +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 {
|
||||
let result;
|
||||
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) {
|
||||
|
||||
@@ -44,11 +44,16 @@ module.exports = function (User) {
|
||||
if (!data.findUids && data.uid) {
|
||||
const handle = activitypub.helpers.isWebfinger(data.query);
|
||||
if (handle || activitypub.helpers.isUri(data.query)) {
|
||||
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);
|
||||
const local = await activitypub.helpers.resolveLocalId(data.query);
|
||||
if (local.type === 'user') {
|
||||
uids = [local.id];
|
||||
} else {
|
||||
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