search for exact url when filtering related results

This commit is contained in:
Sean Yesmunt 2018-11-14 12:41:50 -05:00
parent 6139cede26
commit 30af6b5483
2 changed files with 13 additions and 21 deletions

12
dist/bundle.js vendored
View file

@ -3365,18 +3365,16 @@ var makeSelectRecommendedContentForUri = exports.makeSelectRecommendedContentFor
var recommendedContent = void 0;
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 searchUris = searchUrisByQuery[title.replace(/\//, ' ')];
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) {
return searchUri !== uri;
return searchUri !== currentUri;
});
recommendedContent = searchUris;
}

View file

@ -293,22 +293,16 @@ export const makeSelectRecommendedContentForUri = (uri) =>
let recommendedContent;
if (claim) {
const {
value: {
stream: {
metadata: { title },
},
},
} = claim;
// If we are at a vanity uri, build the full uri so we can properly filter
const currentUri = atVanityURI
? buildURI({ claimId: claim.claim_id, claimName: claim.name })
: uri;
const { title } = claim.value.stream.metadata;
let searchUris = searchUrisByQuery[title.replace(/\//, ' ')];
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((searchUri) => searchUri !== uri);
searchUris = searchUris.filter((searchUri) => searchUri !== currentUri);
recommendedContent = searchUris;
}
}