diff --git a/ui/component/claimMenuList/index.js b/ui/component/claimMenuList/index.js
index acf6b99d4..30e114eaf 100644
--- a/ui/component/claimMenuList/index.js
+++ b/ui/component/claimMenuList/index.js
@@ -5,7 +5,6 @@ import {
makeSelectFileInfoForUri,
doPrepareEdit,
makeSelectCollectionForIdHasClaimUrl,
- makeSelectNameForCollectionId,
makeSelectCollectionIsMine,
COLLECTIONS_CONSTS,
makeSelectEditedCollectionForId,
@@ -34,20 +33,28 @@ import fs from 'fs';
const select = (state, props) => {
const claim = makeSelectClaimForUri(props.uri, false)(state);
- const permanentUri = claim && claim.permanent_url;
+ const repostedClaim = claim && claim.reposted_claim;
+ const contentClaim = repostedClaim || claim;
+ const contentSigningChannel = contentClaim && contentClaim.signing_channel;
+ const contentPermanentUri = contentClaim && contentClaim.permanent_url;
+ const contentChannelUri = (contentSigningChannel && contentSigningChannel.permanent_url) || contentPermanentUri;
+
return {
claim,
+ repostedClaim,
+ contentClaim,
+ contentSigningChannel,
+ contentChannelUri,
claimIsMine: makeSelectSigningIsMine(props.uri)(state),
- hasClaimInWatchLater: makeSelectCollectionForIdHasClaimUrl(COLLECTIONS_CONSTS.WATCH_LATER_ID, permanentUri)(state),
- hasClaimInCustom: makeSelectCollectionForIdHasClaimUrl(COLLECTIONS_CONSTS.FAVORITES_ID, permanentUri)(state),
- channelIsMuted: makeSelectChannelIsMuted(props.uri)(state),
- channelIsBlocked: makeSelectChannelIsBlocked(props.uri)(state),
+ hasClaimInWatchLater: makeSelectCollectionForIdHasClaimUrl(COLLECTIONS_CONSTS.WATCH_LATER_ID, contentPermanentUri)(state),
+ hasClaimInCustom: makeSelectCollectionForIdHasClaimUrl(COLLECTIONS_CONSTS.FAVORITES_ID, contentPermanentUri)(state),
+ channelIsMuted: makeSelectChannelIsMuted(contentChannelUri)(state),
+ channelIsBlocked: makeSelectChannelIsBlocked(contentChannelUri)(state),
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
- isSubscribed: makeSelectIsSubscribed(props.channelUri, true)(state),
+ isSubscribed: makeSelectIsSubscribed(contentChannelUri, true)(state),
channelIsAdminBlocked: makeSelectChannelIsAdminBlocked(props.uri)(state),
isAdmin: selectHasAdminChannel(state),
- claimInCollection: makeSelectCollectionForIdHasClaimUrl(props.collectionId, permanentUri)(state),
- collectionName: makeSelectNameForCollectionId(props.collectionId)(state),
+ claimInCollection: makeSelectCollectionForIdHasClaimUrl(props.collectionId, contentPermanentUri)(state),
isMyCollection: makeSelectCollectionIsMine(props.collectionId)(state),
editedCollection: makeSelectEditedCollectionForId(props.collectionId)(state),
isAuthenticated: Boolean(selectUserVerifiedEmail(state)),
@@ -71,7 +78,8 @@ const perform = (dispatch) => ({
doChannelUnmute: (channelUri) => dispatch(doChannelUnmute(channelUri)),
doCommentModBlock: (channelUri) => dispatch(doCommentModBlock(channelUri)),
doCommentModUnBlock: (channelUri) => dispatch(doCommentModUnBlock(channelUri)),
- doCommentModBlockAsAdmin: (commenterUri, blockerId) => dispatch(doCommentModBlockAsAdmin(commenterUri, blockerId)),
+ doCommentModBlockAsAdmin: (commenterUri, blockerId) =>
+ dispatch(doCommentModBlockAsAdmin(commenterUri, blockerId)),
doCommentModUnBlockAsAdmin: (commenterUri, blockerId) =>
dispatch(doCommentModUnBlockAsAdmin(commenterUri, blockerId)),
doChannelSubscribe: (subscription) => dispatch(doChannelSubscribe(subscription)),
diff --git a/ui/component/claimMenuList/view.jsx b/ui/component/claimMenuList/view.jsx
index bc38196f1..6220cc783 100644
--- a/ui/component/claimMenuList/view.jsx
+++ b/ui/component/claimMenuList/view.jsx
@@ -23,8 +23,11 @@ type SubscriptionArgs = {
type Props = {
uri: string,
- channelUri: string,
claim: ?Claim,
+ repostedClaim: ?Claim,
+ contentClaim: ?Claim,
+ contentSigningChannel: ?Claim,
+ contentChannelUri: string,
openModal: (id: string, {}) => void,
inline?: boolean,
channelIsMuted: boolean,
@@ -37,12 +40,10 @@ type Props = {
doCommentModUnBlock: (string) => void,
doCommentModBlockAsAdmin: (string, string) => void,
doCommentModUnBlockAsAdmin: (string, string) => void,
- isRepost: boolean,
doCollectionEdit: (string, any) => void,
hasClaimInWatchLater: boolean,
hasClaimInCustom: boolean,
claimInCollection: boolean,
- collectionName?: string,
collectionId: string,
isMyCollection: boolean,
doToast: ({ message: string, isError?: boolean }) => void,
@@ -60,8 +61,11 @@ type Props = {
function ClaimMenuList(props: Props) {
const {
uri,
- channelUri,
claim,
+ repostedClaim,
+ contentClaim,
+ contentSigningChannel,
+ contentChannelUri,
openModal,
inline = false,
doChannelMute,
@@ -72,14 +76,12 @@ function ClaimMenuList(props: Props) {
isAdmin,
doCommentModBlock,
doCommentModUnBlock,
- isRepost,
doCommentModBlockAsAdmin,
doCommentModUnBlockAsAdmin,
doCollectionEdit,
hasClaimInWatchLater,
hasClaimInCustom,
collectionId,
- collectionName,
isMyCollection,
doToast,
claimIsMine,
@@ -92,15 +94,16 @@ function ClaimMenuList(props: Props) {
editedCollection,
isAuthenticated,
} = props;
- const repostedContent = claim && claim.reposted_claim;
- const contentClaim = repostedContent || claim;
- const incognitoClaim = channelUri && !channelUri.includes('@');
- const signingChannel = claim && (claim.signing_channel || claim);
- const permanentUrl = String(channelUri);
- const isChannel = !incognitoClaim && signingChannel === claim;
+ const incognitoClaim = contentChannelUri && !contentChannelUri.includes('@');
+ const isChannel = !incognitoClaim && !contentSigningChannel;
+ const { channelName } = parseURI(contentChannelUri);
const showDelete = claimIsMine || (fileInfo && (fileInfo.written_bytes > 0 || fileInfo.blobs_completed > 0));
- const subscriptionLabel = isSubscribed ? __('Unfollow') : __('Follow');
+ const subscriptionLabel = __('%action%' + '%user%', {
+ action: isSubscribed ? __('Unfollow') : __('Follow'),
+ user: repostedClaim ? __(' @' + channelName) : '',
+ });
const lastCollectionName = 'Favorites';
+ const lastCollectionId = COLLECTIONS_CONSTS.FAVORITES_ID;
const { push, replace } = useHistory();
if (!claim) {
@@ -121,36 +124,46 @@ function ClaimMenuList(props: Props) {
// $FlowFixMe
(contentClaim.value.stream_type === 'audio' || contentClaim.value.stream_type === 'video');
+ function handleAdd(source, name, collectionId) {
+ doToast({
+ message: source ? __('Item removed from %name%', { name }) : __('Item added to %name%', { name }),
+ });
+ doCollectionEdit(collectionId, {
+ claims: [contentClaim],
+ remove: source,
+ type: 'playlist',
+ });
+ }
+
function handleFollow() {
- const { channelName } = parseURI(permanentUrl);
const subscriptionHandler = isSubscribed ? doChannelUnsubscribe : doChannelSubscribe;
subscriptionHandler({
channelName: '@' + channelName,
- uri: permanentUrl,
+ uri: contentChannelUri,
notificationsDisabled: true,
});
}
function handleToggleMute() {
if (channelIsMuted) {
- doChannelUnmute(channelUri);
+ doChannelUnmute(contentChannelUri);
} else {
- doChannelMute(channelUri);
+ doChannelMute(contentChannelUri);
}
}
function handleToggleBlock() {
if (channelIsBlocked) {
- doCommentModUnBlock(channelUri);
+ doCommentModUnBlock(contentChannelUri);
} else {
- doCommentModBlock(channelUri);
+ doCommentModBlock(contentChannelUri);
}
}
function handleEdit() {
if (!isChannel) {
- const signingChannelName = signingChannel && signingChannel.name;
+ const signingChannelName = contentSigningChannel && contentSigningChannel.name;
const uriObject: { streamName: string, streamClaimId: string, channelName?: string } = {
streamName: claim.name,
@@ -170,10 +183,10 @@ function ClaimMenuList(props: Props) {
}
function handleDelete() {
- if (!isRepost && !isChannel) {
- openModal(MODALS.CONFIRM_FILE_REMOVE, { uri });
+ if (!repostedClaim && !isChannel) {
+ openModal(MODALS.CONFIRM_FILE_REMOVE, { uri, doGoBack: false });
} else {
- openModal(MODALS.CONFIRM_CLAIM_REVOKE, { claim, cb: !isRepost && (() => replace(`/$/${PAGES.CHANNELS}`)) });
+ openModal(MODALS.CONFIRM_CLAIM_REVOKE, { claim, cb: isChannel && (() => replace(`/$/${PAGES.CHANNELS}`)) });
}
}
@@ -183,9 +196,9 @@ function ClaimMenuList(props: Props) {
function handleToggleAdminBlock() {
if (channelIsAdminBlocked) {
- doCommentModUnBlockAsAdmin(channelUri, '');
+ doCommentModUnBlockAsAdmin(contentChannelUri, '');
} else {
- doCommentModBlockAsAdmin(channelUri, '');
+ doCommentModBlockAsAdmin(contentChannelUri, '');
}
}
@@ -210,7 +223,7 @@ function ClaimMenuList(props: Props) {
function handleReportContent() {
// $FlowFixMe
- push(`/$/${PAGES.REPORT_CONTENT}?claimId=${(repostedContent && repostedContent.claim_id) || claim.claim_id}`);
+ push(`/$/${PAGES.REPORT_CONTENT}?claimId=${contentClaim && contentClaim.claim_id}`);
}
return (
@@ -228,101 +241,79 @@ function ClaimMenuList(props: Props) {
{(!IS_WEB || (IS_WEB && isAuthenticated)) && (
<>
<>
- {/* WATCH LATER */}
- {isPlayable && !collectionId && (
-
- )}
- {/* CUSTOM LIST */}
- {isPlayable && !collectionId && (
-
- )}
{/* COLLECTION OPERATIONS */}
- {collectionId && collectionName && isCollectionClaim && (
+ {collectionId && isCollectionClaim ? (
<>
- {Boolean(editedCollection) && (
-
- )}
-
+ {isMyCollection && (
+ <>
+
+
+ >
+ )}
>
- )}
- {/* CURRENTLY ONLY SUPPORT PLAYLISTS FOR PLAYABLE; LATER DIFFERENT TYPES */}
- {isPlayable && (
-
+ ) : (
+ isPlayable && (
+ <>
+ {/* WATCH LATER */}
+
+ {/* CUSTOM LIST */}
+
+ {/* CURRENTLY ONLY SUPPORT PLAYLISTS FOR PLAYABLE; LATER DIFFERENT TYPES */}
+
+
+ >
+ )
)}
>
+
{!isChannelPage && (
<>
-