diff --git a/web/src/chainquery.js b/web/src/chainquery.js index a49414dbd..5725cdac4 100644 --- a/web/src/chainquery.js +++ b/web/src/chainquery.js @@ -12,7 +12,6 @@ function queryPool(sql, params) { return new Promise(resolve => { pool.query(sql, params, (error, rows) => { if (error) { - console.log('error', error); resolve(); return; } @@ -26,13 +25,9 @@ module.exports.getClaim = async function getClaim(claimName, claimId, channelNam let params = [claimName]; let sql = - 'SELECT channel_claim.name as channel, claim.claim_id, claim.name, claim.description, claim.language, claim.thumbnail_url, claim.title, claim.source_media_type, claim.frame_width, claim.frame_height, claim.fee, ' + - 'repost_channel.name as repost_channel, reposted_claim.claim_id as reposted_claim_id, reposted_claim.name as reposted_name, reposted_claim.description as reposted_description, reposted_claim.language as reposted_language, reposted_claim.thumbnail_url as reposted_thumbnail_url, reposted_claim.title as reposted_title, reposted_claim.source_media_type as reposted_source_media_type, reposted_claim.frame_width as reposted_frame_width, reposted_claim.frame_height as reposted_frame_height, reposted_claim.fee as reposted_fee ' + + 'SELECT channel_claim.name as channel, claim.claim_id, claim.name, claim.description, claim.language, claim.thumbnail_url, claim.title, claim.source_media_type, claim.frame_width, claim.frame_height, claim.fee ' + 'FROM claim ' + 'LEFT JOIN claim channel_claim on claim.publisher_id = channel_claim.claim_id ' + - 'LEFT JOIN claim as reposted_claim on reposted_claim.claim_id = claim.claim_reference ' + - 'AND (reposted_claim.bid_state="controlling" OR reposted_claim.bid_state="active")' + - 'LEFT JOIN claim as repost_channel on repost_channel.claim_id = reposted_claim.publisher_id ' + 'WHERE claim.name = ?'; if (claimId) { diff --git a/web/src/html.js b/web/src/html.js index c52cfe96b..535fca460 100644 --- a/web/src/html.js +++ b/web/src/html.js @@ -138,7 +138,7 @@ function buildClaimOgMetadata(uri, claim, overrideOptions = {}) { return head; } -async function getClaimFromChainqueryOrRedirect(url, ctx) { +async function getClaimFromChainquery(url) { const { isChannel, streamName, channelName, channelClaimId, streamClaimId } = parseURI(url); const claimName = isChannel ? '@' + channelName : streamName; const claimId = isChannel ? channelClaimId : streamClaimId; @@ -146,12 +146,6 @@ async function getClaimFromChainqueryOrRedirect(url, ctx) { const rows = await getClaim(claimName, claimId, channelName, channelClaimId); if (rows && rows.length) { const claim = rows[0]; - - if (claim.reposted_name && claim.reposted_claim_id) { - ctx.redirect(`/${claim.reposted_name}:${claim.reposted_claim_id}`); - return; - } - return claim; } @@ -179,7 +173,7 @@ async function getHtml(ctx) { try { parseURI(inviteChannelUrl); - const claim = await getClaimFromChainqueryOrRedirect(inviteChannelUrl, ctx); + const claim = await getClaimFromChainquery(inviteChannelUrl); const invitePageMetadata = buildClaimOgMetadata(inviteChannelUrl, claim, { title: `Join ${claim.name} on LBRY`, description: `Join ${claim.name} on LBRY, a content wonderland owned by everyone (and no one).`, @@ -199,7 +193,7 @@ async function getHtml(ctx) { if (requestPath.includes(embedPath)) { const claimUri = requestPath.replace(embedPath, '').replace(/:/g, '#'); - const claim = await getClaimFromChainqueryOrRedirect(claimUri, ctx); + const claim = await getClaimFromChainquery(claimUri); if (claim) { const ogMetadata = buildClaimOgMetadata(claimUri, claim); @@ -211,8 +205,8 @@ async function getHtml(ctx) { if (!requestPath.includes('$')) { const claimUri = requestPath.slice(1).replace(/:/g, '#'); - const claim = await getClaimFromChainqueryOrRedirect(claimUri, ctx); - console.log('claim', claim); + const claim = await getClaimFromChainquery(claimUri); + if (claim) { const ogMetadata = buildClaimOgMetadata(claimUri, claim); return insertToHead(html, ogMetadata);