Merge pull request #103 from lbryio/related
search for exact url when filtering related results
This commit is contained in:
commit
169089a2b0
2 changed files with 13 additions and 21 deletions
12
dist/bundle.js
vendored
12
dist/bundle.js
vendored
|
@ -3365,18 +3365,16 @@ var makeSelectRecommendedContentForUri = exports.makeSelectRecommendedContentFor
|
||||||
|
|
||||||
var recommendedContent = void 0;
|
var recommendedContent = void 0;
|
||||||
if (claim) {
|
if (claim) {
|
||||||
|
// If we are at a vanity uri, build the full uri so we can properly filter
|
||||||
|
var currentUri = atVanityURI ? (0, _lbryURI.buildURI)({ claimId: claim.claim_id, claimName: claim.name }) : uri;
|
||||||
|
|
||||||
var title = claim.value.stream.metadata.title;
|
var title = claim.value.stream.metadata.title;
|
||||||
|
|
||||||
|
|
||||||
var searchUris = searchUrisByQuery[title.replace(/\//, ' ')];
|
var searchUris = searchUrisByQuery[title.replace(/\//, ' ')];
|
||||||
if (searchUris) {
|
if (searchUris) {
|
||||||
// If we are at a vanity uri, we can't do a uri match
|
|
||||||
// The first search result _should_ be the same as the claim a user is on
|
|
||||||
if (atVanityURI) {
|
|
||||||
searchUris = searchUris.slice(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
searchUris = searchUris.filter(function (searchUri) {
|
searchUris = searchUris.filter(function (searchUri) {
|
||||||
return searchUri !== uri;
|
return searchUri !== currentUri;
|
||||||
});
|
});
|
||||||
recommendedContent = searchUris;
|
recommendedContent = searchUris;
|
||||||
}
|
}
|
||||||
|
|
|
@ -293,22 +293,16 @@ export const makeSelectRecommendedContentForUri = (uri) =>
|
||||||
|
|
||||||
let recommendedContent;
|
let recommendedContent;
|
||||||
if (claim) {
|
if (claim) {
|
||||||
const {
|
// If we are at a vanity uri, build the full uri so we can properly filter
|
||||||
value: {
|
const currentUri = atVanityURI
|
||||||
stream: {
|
? buildURI({ claimId: claim.claim_id, claimName: claim.name })
|
||||||
metadata: { title },
|
: uri;
|
||||||
},
|
|
||||||
},
|
const { title } = claim.value.stream.metadata;
|
||||||
} = claim;
|
|
||||||
let searchUris = searchUrisByQuery[title.replace(/\//, ' ')];
|
let searchUris = searchUrisByQuery[title.replace(/\//, ' ')];
|
||||||
if (searchUris) {
|
if (searchUris) {
|
||||||
// If we are at a vanity uri, we can't do a uri match
|
searchUris = searchUris.filter((searchUri) => searchUri !== currentUri);
|
||||||
// The first search result _should_ be the same as the claim a user is on
|
|
||||||
if (atVanityURI) {
|
|
||||||
searchUris = searchUris.slice(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
searchUris = searchUris.filter((searchUri) => searchUri !== uri);
|
|
||||||
recommendedContent = searchUris;
|
recommendedContent = searchUris;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue