FileViewCountInline: fix incorrect logic

4a22814c broke the intention of if-block (it essentially breaks the functionality in Search page if we enable view counts there in the future).

It also seems completely unrelated to the PR.
This commit is contained in:
infinite-persistence 2021-10-28 09:30:17 +08:00
parent 1a5fb5fa51
commit f8f9b86cb4
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0

View file

@ -30,9 +30,6 @@ export default function FileViewCountInline(props: Props) {
// clean up (only one place edit/remove). // clean up (only one place edit/remove).
const isChannelPage = window.location.pathname.startsWith('/@'); const isChannelPage = window.location.pathname.startsWith('/@');
// Checks if search page and gives a bullet between claim name and ago.
const isSearchPage = window.location.pathname.startsWith('/$/search');
// dont show if no view count, if it's a repost, a livestream or isn't a channel page // dont show if no view count, if it's a repost, a livestream or isn't a channel page
if (!viewCount || (claim && claim.repost_url) || isLivestream || !isChannelPage) { if (!viewCount || (claim && claim.repost_url) || isLivestream || !isChannelPage) {
// (1) Currently, makeSelectViewCountForUri doesn't differentiate between // (1) Currently, makeSelectViewCountForUri doesn't differentiate between
@ -40,12 +37,7 @@ export default function FileViewCountInline(props: Props) {
// ideal to highlight that a view has 0 count, let's just not show anything. // ideal to highlight that a view has 0 count, let's just not show anything.
// (2) No idea how to get the repost source's claim ID from the repost claim, // (2) No idea how to get the repost source's claim ID from the repost claim,
// so hiding it for now. // so hiding it for now.
if (isSearchPage) { return null;
return <>&nbsp;&bull;&nbsp; </>;
}
else {
return null;
}
} }
return ( return (