Skip to content

Commit

Permalink
SocialShare: enabled Embed and Social buttons for Unlisted
Browse files Browse the repository at this point in the history
Closes 2947
  • Loading branch information
infinite-persistence committed Sep 6, 2023
1 parent 440e141 commit f7f50a2
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions ui/component/socialShare/view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Spinner from 'component/spinner';
import { generateDownloadUrl, generateNewestUrl } from 'util/web';
import { useIsMobile } from 'effects/use-screensize';
import { FormField } from 'component/common/form';
import { getClaimScheduledState, isClaimPrivate, isClaimUnlisted } from 'util/claim';
import { getClaimScheduledState, isClaimUnlisted } from 'util/claim';
import { hmsToSeconds, secondsToHms } from 'util/time';
import { generateLbryContentUrl, generateRssUrl } from 'util/url';
import { URL as SITE_URL, TWITTER_ACCOUNT, SHARE_DOMAIN_URL } from 'config';
Expand Down Expand Up @@ -120,8 +120,7 @@ function SocialShare(props: SocialShareStateProps) {
const [showClaimLinks, setShowClaimLinks] = React.useState(false);
const [includeStartTime, setincludeStartTime]: [boolean, any] = React.useState(false);
const [startTime, setStartTime]: [string, any] = React.useState(secondsToHms(position));
const showAdditionalShareOptions =
!isClaimUnlisted(claim) && !isClaimPrivate(claim) && getClaimScheduledState(claim) !== 'scheduled';
const showAdditionalShareOptions = getClaimScheduledState(claim) !== 'scheduled';
const startTimeSeconds: number = hmsToSeconds(startTime);
const isMobile = useIsMobile();

Expand All @@ -131,6 +130,7 @@ function SocialShare(props: SocialShareStateProps) {
const isStream = claim.value_type === 'stream';
const isVideo = isStream && claim.value.stream_type === 'video';
const isAudio = isStream && claim.value.stream_type === 'audio';
const isUnlisted = isClaimUnlisted(claim);
const showStartAt = isVideo || isAudio;
const rewardsApproved = user && user.is_reward_approved;
const lbryUrl: string = generateLbryContentUrl(canonicalUrl, permanentUrl);
Expand Down Expand Up @@ -168,7 +168,14 @@ function SocialShare(props: SocialShareStateProps) {
function getClaimLinkElements() {
const elements: Array<Node> = [];

if (Boolean(isStream) && !disableDownloadButton && !isMature && !isMembershipProtected && !isFiatRequired) {
if (
Boolean(isStream) &&
!disableDownloadButton &&
!isMature &&
!isMembershipProtected &&
!isFiatRequired &&
!isUnlisted
) {
elements.push(<CopyableText label={__('Download Link')} copyable={downloadUrl} key="download" />);
}

Expand Down

0 comments on commit f7f50a2

Please sign in to comment.