Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a7c95d0bc9 |
No files matched your search
Vendored
+3
-1
@@ -204,9 +204,11 @@ declare type ModerationBlockParams = {
|
||||
// Creator that Moderator is delegated from. Used for delegated moderation
|
||||
creator_channel_id?: string,
|
||||
creator_channel_name?: string,
|
||||
// ID of comment to remove as part of this block
|
||||
offending_comment_id?: string,
|
||||
// Blocks identity from comment universally, requires Admin rights on commentron instance
|
||||
block_all?: boolean,
|
||||
time_out?: number,
|
||||
time_out?: ?number,
|
||||
// If true will delete all comments of the offender, requires Admin rights on commentron for universal delete
|
||||
delete_all?: boolean,
|
||||
// The usual signature stuff
|
||||
|
||||
@@ -11,11 +11,11 @@ type Props = {
|
||||
isBlockingOrUnBlocking: boolean,
|
||||
isToggling: boolean,
|
||||
doCommentModUnBlock: (string, boolean) => void,
|
||||
doCommentModBlock: (string, ?Number, boolean) => void,
|
||||
doCommentModBlock: (string, ?string, ?Number, boolean) => void,
|
||||
doCommentModUnBlockAsAdmin: (string, string) => void,
|
||||
doCommentModBlockAsAdmin: (string, string) => void,
|
||||
doCommentModBlockAsAdmin: (string, ?string, ?string) => void,
|
||||
doCommentModUnBlockAsModerator: (string, string, string) => void,
|
||||
doCommentModBlockAsModerator: (string, string, string) => void,
|
||||
doCommentModBlockAsModerator: (string, ?string, string, ?string) => void,
|
||||
};
|
||||
|
||||
function ChannelBlockButton(props: Props) {
|
||||
@@ -41,7 +41,7 @@ function ChannelBlockButton(props: Props) {
|
||||
if (isBlocked) {
|
||||
doCommentModUnBlock(uri, false);
|
||||
} else {
|
||||
doCommentModBlock(uri, undefined, false);
|
||||
doCommentModBlock(uri, undefined, undefined, false);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -50,7 +50,7 @@ function ChannelBlockButton(props: Props) {
|
||||
if (isBlocked) {
|
||||
doCommentModUnBlockAsModerator(uri, creatorUri, '');
|
||||
} else {
|
||||
doCommentModBlockAsModerator(uri, creatorUri, '');
|
||||
doCommentModBlockAsModerator(uri, undefined, creatorUri, undefined);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -59,7 +59,7 @@ function ChannelBlockButton(props: Props) {
|
||||
if (isBlocked) {
|
||||
doCommentModUnBlockAsAdmin(uri, '');
|
||||
} else {
|
||||
doCommentModBlockAsAdmin(uri, '');
|
||||
doCommentModBlockAsAdmin(uri, undefined, undefined);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ type Props = {
|
||||
doChannelUnmute: (string) => void,
|
||||
doCommentModBlock: (string) => void,
|
||||
doCommentModUnBlock: (string) => void,
|
||||
doCommentModBlockAsAdmin: (string, string) => void,
|
||||
doCommentModBlockAsAdmin: (commenterUri: string, offendingCommentId: ?string, blockerId: ?string) => void,
|
||||
doCommentModUnBlockAsAdmin: (string, string) => void,
|
||||
doCollectionEdit: (string, any) => void,
|
||||
hasClaimInWatchLater: boolean,
|
||||
@@ -228,7 +228,7 @@ function ClaimMenuList(props: Props) {
|
||||
if (channelIsAdminBlocked) {
|
||||
doCommentModUnBlockAsAdmin(contentChannelUri, '');
|
||||
} else {
|
||||
doCommentModBlockAsAdmin(contentChannelUri, '');
|
||||
doCommentModBlockAsAdmin(contentChannelUri, undefined, undefined);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import { isEmpty } from 'util/object';
|
||||
import classnames from 'classnames';
|
||||
import { isURIValid } from 'util/lbryURI';
|
||||
import * as COLLECTIONS_CONSTS from 'constants/collections';
|
||||
import { isChannelClaim } from 'util/claim';
|
||||
import { formatLbryUrlForWeb } from 'util/url';
|
||||
import { formatClaimPreviewTitle } from 'util/formatAriaLabel';
|
||||
import FileThumbnail from 'component/fileThumbnail';
|
||||
@@ -171,7 +170,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
claim.value.stream_type &&
|
||||
// $FlowFixMe
|
||||
(claim.value.stream_type === 'audio' || claim.value.stream_type === 'video');
|
||||
const isChannelUri = isChannelClaim(claim, uri);
|
||||
const isChannelUri = claim ? claim.value_type === 'channel' : false;
|
||||
const signingChannel = claim && claim.signing_channel;
|
||||
const repostedChannelUri =
|
||||
claim && claim.repost_channel_url && claim.value_type === 'channel'
|
||||
|
||||
@@ -21,7 +21,6 @@ type Props = {
|
||||
// --- select ---
|
||||
claim: ?Claim,
|
||||
claimIsMine: boolean,
|
||||
contentChannelPermanentUrl: any,
|
||||
activeChannelClaim: ?ChannelClaim,
|
||||
playingUri: ?PlayingUri,
|
||||
moderationDelegatorsById: { [string]: { global: boolean, delegators: { name: string, claimId: string } } },
|
||||
@@ -44,7 +43,6 @@ function CommentMenuList(props: Props) {
|
||||
commentIsMine,
|
||||
commentId,
|
||||
activeChannelClaim,
|
||||
contentChannelPermanentUrl,
|
||||
isTopLevel,
|
||||
isPinned,
|
||||
playingUri,
|
||||
@@ -62,6 +60,8 @@ function CommentMenuList(props: Props) {
|
||||
} = props;
|
||||
|
||||
const contentChannelClaim = getChannelFromClaim(claim);
|
||||
const contentChannelPermanentUrl = contentChannelClaim && contentChannelClaim.permanent_url;
|
||||
|
||||
const activeModeratorInfo = activeChannelClaim && moderationDelegatorsById[activeChannelClaim.claim_id];
|
||||
const activeChannelIsCreator = activeChannelClaim && activeChannelClaim.permanent_url === contentChannelPermanentUrl;
|
||||
const activeChannelIsAdmin = activeChannelClaim && activeModeratorInfo && activeModeratorInfo.global;
|
||||
@@ -75,10 +75,12 @@ function CommentMenuList(props: Props) {
|
||||
if (playingUri && playingUri.source === 'comment') {
|
||||
clearPlayingUri();
|
||||
}
|
||||
|
||||
openModal(MODALS.CONFIRM_REMOVE_COMMENT, {
|
||||
commentId,
|
||||
commentIsMine,
|
||||
contentChannelPermanentUrl,
|
||||
deleterClaim: activeChannelClaim,
|
||||
deleterIsModOrAdmin: activeChannelIsAdmin || activeChannelIsModerator,
|
||||
creatorClaim: commentIsMine ? undefined : contentChannelClaim,
|
||||
supportAmount,
|
||||
setQuickReply,
|
||||
});
|
||||
@@ -183,7 +185,9 @@ function CommentMenuList(props: Props) {
|
||||
|
||||
{!disableRemove &&
|
||||
activeChannelClaim &&
|
||||
(activeChannelClaim.permanent_url === authorUri ||
|
||||
(activeChannelIsModerator ||
|
||||
activeChannelIsAdmin ||
|
||||
activeChannelClaim.permanent_url === authorUri ||
|
||||
activeChannelClaim.permanent_url === contentChannelPermanentUrl) && (
|
||||
<MenuItem className="comment__menu-option" onSelect={handleDeleteComment}>
|
||||
<div className="menu__link">
|
||||
@@ -197,7 +201,13 @@ function CommentMenuList(props: Props) {
|
||||
<>
|
||||
<MenuItem
|
||||
className="comment__menu-option"
|
||||
onSelect={() => openModal(MODALS.BLOCK_CHANNEL, { contentUri: uri, commenterUri: authorUri })}
|
||||
onSelect={() =>
|
||||
openModal(MODALS.BLOCK_CHANNEL, {
|
||||
contentUri: uri,
|
||||
commenterUri: authorUri,
|
||||
offendingCommentId: commentId,
|
||||
})
|
||||
}
|
||||
>
|
||||
{getBlockOptionElem()}
|
||||
</MenuItem>
|
||||
|
||||
@@ -12,6 +12,7 @@ import { PRIMARY_PLAYER_WRAPPER_CLASS } from 'page/file/view';
|
||||
import Draggable from 'react-draggable';
|
||||
import { onFullscreenChange } from 'util/full-screen';
|
||||
import { generateListSearchUrlParams, formatLbryUrlForWeb } from 'util/url';
|
||||
import { useIsMobile } from 'effects/use-screensize';
|
||||
import debounce from 'util/debounce';
|
||||
import { useHistory } from 'react-router';
|
||||
import { isURIEqual } from 'util/lbryURI';
|
||||
@@ -126,6 +127,7 @@ export default function FileRenderFloating(props: Props) {
|
||||
const hideFloatingPlayer = location.state && location.state.hideFloatingPlayer;
|
||||
const playingUriSource = playingUri && playingUri.source;
|
||||
const isComment = playingUriSource === 'comment';
|
||||
const isMobile = useIsMobile();
|
||||
const mainFilePlaying = !isFloating && primaryUri && isURIEqual(uri, primaryUri);
|
||||
|
||||
const [fileViewerRect, setFileViewerRect] = useState();
|
||||
@@ -289,7 +291,7 @@ export default function FileRenderFloating(props: Props) {
|
||||
if (
|
||||
!isPlayable ||
|
||||
!uri ||
|
||||
(isFloating && (!floatingPlayerEnabled || hideFloatingPlayer)) ||
|
||||
(isFloating && (isMobile || !floatingPlayerEnabled || hideFloatingPlayer)) ||
|
||||
(collectionId && !isFloating && ((!canViewFile && !nextListUri) || countdownCanceled))
|
||||
) {
|
||||
return null;
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { selectClaimIdForUri } from 'redux/selectors/claims';
|
||||
import { selectClaimForUri } from 'redux/selectors/claims';
|
||||
import { doFetchViewCount, selectViewCountForUri } from 'lbryinc';
|
||||
import { doAnalyticsView } from 'redux/actions/app';
|
||||
import FileViewCount from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
const claimId = selectClaimIdForUri(state, props.uri);
|
||||
return {
|
||||
claimId,
|
||||
viewCount: selectViewCountForUri(state, props.uri),
|
||||
};
|
||||
};
|
||||
const select = (state, props) => ({
|
||||
claim: selectClaimForUri(state, props.uri),
|
||||
viewCount: selectViewCountForUri(state, props.uri),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
fetchViewCount: (claimId) => dispatch(doFetchViewCount(claimId)),
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import HelpLink from 'component/common/help-link';
|
||||
import Tooltip from 'component/common/tooltip';
|
||||
import { toCompactNotation } from 'util/string';
|
||||
|
||||
type Props = {
|
||||
claimId: ?string, // this
|
||||
claim: ?StreamClaim,
|
||||
fetchViewCount: (string) => void,
|
||||
fetchingViewCount: boolean,
|
||||
uri: string,
|
||||
@@ -13,9 +11,8 @@ type Props = {
|
||||
};
|
||||
|
||||
function FileViewCount(props: Props) {
|
||||
const { claimId, uri, fetchViewCount, viewCount } = props; // claimId
|
||||
const countCompact = toCompactNotation(viewCount);
|
||||
const countFullResolution = Number(viewCount).toLocaleString();
|
||||
const { claim, uri, fetchViewCount, viewCount } = props;
|
||||
const claimId = claim && claim.claim_id;
|
||||
|
||||
React.useEffect(() => {
|
||||
if (claimId) {
|
||||
@@ -23,13 +20,13 @@ function FileViewCount(props: Props) {
|
||||
}
|
||||
}, [fetchViewCount, uri, claimId]);
|
||||
|
||||
const formattedViewCount = Number(viewCount).toLocaleString();
|
||||
|
||||
return (
|
||||
<Tooltip label={countFullResolution}>
|
||||
<span className="media__subtitle--centered">
|
||||
{viewCount !== 1 ? __('%view_count% views', { view_count: countCompact }) : __('1 view')}
|
||||
{<HelpLink href="https://lbry.com/faq/views" />}
|
||||
</span>
|
||||
</Tooltip>
|
||||
<span className="media__subtitle--centered">
|
||||
{viewCount !== 1 ? __('%view_count% views', { view_count: formattedViewCount }) : __('1 view')}
|
||||
{<HelpLink href="https://lbry.com/faq/views" />}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
import React from 'react';
|
||||
import 'scss/component/_view_count.scss';
|
||||
import { useHistory } from 'react-router';
|
||||
import { toCompactNotation } from 'util/string';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
@@ -17,7 +16,17 @@ export default function FileViewCountInline(props: Props) {
|
||||
const {
|
||||
location: { pathname },
|
||||
} = useHistory();
|
||||
const formattedViewCount = toCompactNotation(viewCount, lang);
|
||||
let formattedViewCount;
|
||||
|
||||
try {
|
||||
// SI notation that changes 1234 to 1.2K, look up Intl.NumberFormat() for docs
|
||||
formattedViewCount = Number(viewCount).toLocaleString(lang || 'en', {
|
||||
compactDisplay: 'short',
|
||||
notation: 'compact',
|
||||
});
|
||||
} catch (err) {
|
||||
formattedViewCount = Number(viewCount).toLocaleString();
|
||||
}
|
||||
|
||||
// Limit the view-count visibility to Channel Pages for now. I believe we'll
|
||||
// eventually show it everywhere, so this band-aid would be the easiest to
|
||||
|
||||
@@ -225,6 +225,18 @@ export default function SettingSystem(props: Props) {
|
||||
{__("If disabled, LBRY will be very sad and you won't be helping improve the network.")}{' '}
|
||||
{__('If you set a limit, playing videos may exceed your limit until cleanup runs every 30 minutes.')}{' '}
|
||||
<Button button="link" label={__('Learn more')} href="https://lbry.com/faq/host-content" />.
|
||||
<p className={'help'}>
|
||||
{`Content Hosting using ${formatBytes(contentSpaceUsed * BYTES_PER_MB)} of ${
|
||||
daemonSettings[DAEMON_SETTINGS.BLOB_STORAGE_LIMIT_MB]
|
||||
? formatBytes(daemonSettings[DAEMON_SETTINGS.BLOB_STORAGE_LIMIT_MB] * BYTES_PER_MB)
|
||||
: 'Unlimited'
|
||||
}`}
|
||||
</p>
|
||||
<p className={'help'}>
|
||||
{`Network Hosting using ${formatBytes(networkSpaceUsed * BYTES_PER_MB)} of ${formatBytes(
|
||||
daemonSettings[DAEMON_SETTINGS.NETWORK_STORAGE_LIMIT_MB] * BYTES_PER_MB
|
||||
)}`}
|
||||
</p>
|
||||
</React.Fragment>
|
||||
}
|
||||
>
|
||||
@@ -237,18 +249,6 @@ export default function SettingSystem(props: Props) {
|
||||
label={__('Enable Data Hosting')}
|
||||
/>
|
||||
</fieldset-section>
|
||||
{daemonSettings.save_blobs && (
|
||||
<fieldset-section>
|
||||
<div className={'settings__row-section-title'}>{__('Hosting for content you have downloaded')}</div>
|
||||
<p className={'help'}>
|
||||
{`Content Hosting using ${formatBytes(contentSpaceUsed * BYTES_PER_MB)} of ${
|
||||
daemonSettings[DAEMON_SETTINGS.BLOB_STORAGE_LIMIT_MB]
|
||||
? formatBytes(daemonSettings[DAEMON_SETTINGS.BLOB_STORAGE_LIMIT_MB] * BYTES_PER_MB)
|
||||
: 'Unlimited'
|
||||
}`}
|
||||
</p>
|
||||
</fieldset-section>
|
||||
)}
|
||||
{daemonSettings.save_blobs && (
|
||||
<fieldset-section>
|
||||
<FormField
|
||||
@@ -279,16 +279,6 @@ export default function SettingSystem(props: Props) {
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{daemonSettings.save_blobs && (
|
||||
<fieldset-section>
|
||||
<div className={'settings__row-section-title'}>{__('Hosting content selected by the network')}</div>
|
||||
<p className={'help'}>
|
||||
{`Network Hosting using ${formatBytes(networkSpaceUsed * BYTES_PER_MB)} of ${formatBytes(
|
||||
daemonSettings[DAEMON_SETTINGS.NETWORK_STORAGE_LIMIT_MB] * BYTES_PER_MB
|
||||
)}`}
|
||||
</p>
|
||||
</fieldset-section>
|
||||
)}
|
||||
{daemonSettings.save_blobs && (
|
||||
<FormField
|
||||
name="network_blob_limit_gb"
|
||||
|
||||
@@ -13,11 +13,11 @@ const select = (state, props) => ({
|
||||
moderationDelegatorsById: selectModerationDelegatorsById(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
closeModal: () => dispatch(doHideModal()),
|
||||
commentModBlock: (a, b) => dispatch(doCommentModBlock(a, b)),
|
||||
commentModBlockAsAdmin: (a, b, c) => dispatch(doCommentModBlockAsAdmin(a, b, c)),
|
||||
commentModBlockAsModerator: (a, b, c, d) => dispatch(doCommentModBlockAsModerator(a, b, c, d)),
|
||||
});
|
||||
const perform = {
|
||||
doHideModal,
|
||||
doCommentModBlock,
|
||||
doCommentModBlockAsAdmin,
|
||||
doCommentModBlockAsModerator,
|
||||
};
|
||||
|
||||
export default connect(select, perform)(ModalBlockChannel);
|
||||
@@ -27,18 +27,24 @@ const BLOCK = {
|
||||
type Props = {
|
||||
contentUri: string,
|
||||
commenterUri: string,
|
||||
// --- select ---
|
||||
offendingCommentId?: string,
|
||||
// --- redux ---
|
||||
activeChannelClaim: ?ChannelClaim,
|
||||
contentClaim: ?Claim,
|
||||
moderationDelegatorsById: { [string]: { global: boolean, delegators: { name: string, claimId: string } } },
|
||||
// --- perform ---
|
||||
closeModal: () => void,
|
||||
commentModBlock: (commenterUri: string, timeoutSec: ?number) => void,
|
||||
commentModBlockAsAdmin: (commenterUri: string, blockerId: string, timeoutSec: ?number) => void,
|
||||
commentModBlockAsModerator: (
|
||||
doHideModal: () => void,
|
||||
doCommentModBlock: (commenterUri: string, offendingCommentId: ?string, timeoutSec: ?number) => void,
|
||||
doCommentModBlockAsAdmin: (
|
||||
commenterUri: string,
|
||||
offendingCommentId: ?string,
|
||||
blockerId: ?string,
|
||||
timeoutSec: ?number
|
||||
) => void,
|
||||
doCommentModBlockAsModerator: (
|
||||
commenterUri: string,
|
||||
offendingCommentId: ?string,
|
||||
creatorUri: string,
|
||||
blockerId: string,
|
||||
blockerId: ?string,
|
||||
timeoutSec: ?number
|
||||
) => void,
|
||||
};
|
||||
@@ -46,13 +52,14 @@ type Props = {
|
||||
export default function ModalBlockChannel(props: Props) {
|
||||
const {
|
||||
commenterUri,
|
||||
offendingCommentId,
|
||||
activeChannelClaim,
|
||||
contentClaim,
|
||||
moderationDelegatorsById,
|
||||
closeModal,
|
||||
commentModBlock,
|
||||
commentModBlockAsAdmin,
|
||||
commentModBlockAsModerator,
|
||||
doHideModal,
|
||||
doCommentModBlock,
|
||||
doCommentModBlockAsAdmin,
|
||||
doCommentModBlockAsModerator,
|
||||
} = props;
|
||||
|
||||
const contentChannelClaim = getChannelFromClaim(contentClaim);
|
||||
@@ -227,13 +234,14 @@ export default function ModalBlockChannel(props: Props) {
|
||||
|
||||
switch (tab) {
|
||||
case TAB.PERSONAL:
|
||||
commentModBlock(commenterUri, duration);
|
||||
doCommentModBlock(commenterUri, offendingCommentId, duration);
|
||||
break;
|
||||
|
||||
case TAB.MODERATOR:
|
||||
if (activeChannelClaim && contentChannelClaim) {
|
||||
commentModBlockAsModerator(
|
||||
doCommentModBlockAsModerator(
|
||||
commenterUri,
|
||||
offendingCommentId,
|
||||
contentChannelClaim.permanent_url,
|
||||
activeChannelClaim.claim_id,
|
||||
duration
|
||||
@@ -243,12 +251,12 @@ export default function ModalBlockChannel(props: Props) {
|
||||
|
||||
case TAB.ADMIN:
|
||||
if (activeChannelClaim) {
|
||||
commentModBlockAsAdmin(commenterUri, activeChannelClaim.claim_id, duration);
|
||||
doCommentModBlockAsAdmin(commenterUri, offendingCommentId, activeChannelClaim.claim_id, duration);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
closeModal();
|
||||
doHideModal();
|
||||
}
|
||||
|
||||
// **************************************************************************
|
||||
@@ -256,13 +264,13 @@ export default function ModalBlockChannel(props: Props) {
|
||||
|
||||
if (isPersonalTheOnlyTab && !isTimeoutAvail) {
|
||||
// There's only 1 option. Just execute it and don't show the modal.
|
||||
commentModBlock(commenterUri);
|
||||
closeModal();
|
||||
doCommentModBlock(commenterUri, offendingCommentId);
|
||||
doHideModal();
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<Modal isOpen type="card" onAborted={closeModal}>
|
||||
<Modal isOpen type="card" onAborted={doHideModal}>
|
||||
<Card
|
||||
title={__('Block Channel')}
|
||||
subtitle={getCommenterPreview(commenterUri)}
|
||||
@@ -301,7 +309,7 @@ export default function ModalBlockChannel(props: Props) {
|
||||
<div className="block-modal--finalize">
|
||||
<div className="section__actions">
|
||||
<Button button="primary" label={__('Block')} onClick={handleBlock} disabled={blockButtonDisabled} />
|
||||
<Button button="link" label={__('Cancel')} onClick={closeModal} />
|
||||
<Button button="link" label={__('Cancel')} onClick={doHideModal} />
|
||||
{getActiveChannelElem()}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -862,8 +862,9 @@ function doCommentModToggleBlock(
|
||||
creatorUri: string,
|
||||
blockerIds: Array<string>, // [] = use all my channels
|
||||
blockLevel: string,
|
||||
timeoutSec?: number,
|
||||
showLink: boolean = false
|
||||
timeoutSec: ?number,
|
||||
showLink: boolean = false,
|
||||
offendingCommentId: ?string = undefined
|
||||
) {
|
||||
return async (dispatch: Dispatch, getState: GetState) => {
|
||||
const state = getState();
|
||||
@@ -962,6 +963,7 @@ function doCommentModToggleBlock(
|
||||
signing_ts: signatureData.signing_ts,
|
||||
creator_channel_id: creatorUri ? creatorId : undefined,
|
||||
creator_channel_name: creatorUri ? creatorName : undefined,
|
||||
offending_comment_id: offendingCommentId && !unblock ? offendingCommentId : undefined,
|
||||
block_all: unblock ? undefined : blockLevel === BLOCK_LEVEL.ADMIN,
|
||||
global_un_block: unblock ? blockLevel === BLOCK_LEVEL.ADMIN : undefined,
|
||||
...sharedModBlockParams,
|
||||
@@ -1041,14 +1043,26 @@ function doCommentModToggleBlock(
|
||||
/**
|
||||
* Blocks the commenter for all channels that I own.
|
||||
*
|
||||
* Update: the above it not entirely true now. A blocked channel's comment won't
|
||||
* appear for you anywhere since we now filter the comments at the app-side
|
||||
* before showing it.
|
||||
*
|
||||
* @param commenterUri
|
||||
* @param offendingCommentId
|
||||
* @param timeoutSec
|
||||
* @param showLink
|
||||
* @returns {function(Dispatch): *}
|
||||
*/
|
||||
export function doCommentModBlock(commenterUri: string, timeoutSec?: number, showLink: boolean = true) {
|
||||
export function doCommentModBlock(
|
||||
commenterUri: string,
|
||||
offendingCommentId: ?string,
|
||||
timeoutSec: ?number,
|
||||
showLink: boolean = true
|
||||
) {
|
||||
return (dispatch: Dispatch) => {
|
||||
return dispatch(doCommentModToggleBlock(false, commenterUri, '', [], BLOCK_LEVEL.SELF, timeoutSec, showLink));
|
||||
return dispatch(
|
||||
doCommentModToggleBlock(false, commenterUri, '', [], BLOCK_LEVEL.SELF, timeoutSec, showLink, offendingCommentId)
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1056,14 +1070,29 @@ export function doCommentModBlock(commenterUri: string, timeoutSec?: number, sho
|
||||
* Blocks the commenter using the given channel that has Global privileges.
|
||||
*
|
||||
* @param commenterUri
|
||||
* @param blockerId
|
||||
* @param offendingCommentId
|
||||
* @param blockerId Your specific channel ID to block with, or pass 'undefined' to block it for all of your channels.
|
||||
* @param timeoutSec
|
||||
* @returns {function(Dispatch): *}
|
||||
*/
|
||||
export function doCommentModBlockAsAdmin(commenterUri: string, blockerId: string, timeoutSec?: number) {
|
||||
export function doCommentModBlockAsAdmin(
|
||||
commenterUri: string,
|
||||
offendingCommentId: ?string,
|
||||
blockerId: ?string,
|
||||
timeoutSec: ?number
|
||||
) {
|
||||
return (dispatch: Dispatch) => {
|
||||
return dispatch(
|
||||
doCommentModToggleBlock(false, commenterUri, '', blockerId ? [blockerId] : [], BLOCK_LEVEL.ADMIN, timeoutSec)
|
||||
doCommentModToggleBlock(
|
||||
false,
|
||||
commenterUri,
|
||||
'',
|
||||
blockerId ? [blockerId] : [],
|
||||
BLOCK_LEVEL.ADMIN,
|
||||
timeoutSec,
|
||||
false,
|
||||
offendingCommentId
|
||||
)
|
||||
);
|
||||
};
|
||||
}
|
||||
@@ -1073,16 +1102,18 @@ export function doCommentModBlockAsAdmin(commenterUri: string, blockerId: string
|
||||
* moderation rights by the creator.
|
||||
*
|
||||
* @param commenterUri
|
||||
* @param offendingCommentId
|
||||
* @param creatorUri
|
||||
* @param blockerId
|
||||
* @param blockerId Your specific channel ID to block with, or pass 'undefined' to block it for all of your channels.
|
||||
* @param timeoutSec
|
||||
* @returns {function(Dispatch): *}
|
||||
*/
|
||||
export function doCommentModBlockAsModerator(
|
||||
commenterUri: string,
|
||||
offendingCommentId: ?string,
|
||||
creatorUri: string,
|
||||
blockerId: string,
|
||||
timeoutSec?: number
|
||||
blockerId: ?string,
|
||||
timeoutSec: ?number
|
||||
) {
|
||||
return (dispatch: Dispatch) => {
|
||||
return dispatch(
|
||||
@@ -1092,7 +1123,9 @@ export function doCommentModBlockAsModerator(
|
||||
creatorUri,
|
||||
blockerId ? [blockerId] : [],
|
||||
BLOCK_LEVEL.MODERATOR,
|
||||
timeoutSec
|
||||
timeoutSec,
|
||||
false,
|
||||
offendingCommentId
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
@@ -226,16 +226,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
.settings__row-section-title {
|
||||
min-width: 100%;
|
||||
align-self: flex-start;
|
||||
font-size: var(--font-medium);
|
||||
@media (min-width: $breakpoint-small) {
|
||||
min-width: 60%;
|
||||
max-width: 60%;
|
||||
}
|
||||
}
|
||||
|
||||
.settings__row--subtitle {
|
||||
@extend .section__subtitle;
|
||||
font-size: var(--font-small);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// @flow
|
||||
import { MATURE_TAGS } from 'constants/tags';
|
||||
import { parseURI } from 'util/lbryURI';
|
||||
|
||||
const matureTagMap = MATURE_TAGS.reduce((acc, tag) => ({ ...acc, [tag]: true }), {});
|
||||
|
||||
@@ -67,28 +66,6 @@ export function filterClaims(claims: Array<Claim>, query: ?string): Array<Claim>
|
||||
return claims;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the claim is a channel.
|
||||
*
|
||||
* @param claim
|
||||
* @param uri An abandoned claim will be null, so provide the `uri` as a fallback to parse.
|
||||
*/
|
||||
export function isChannelClaim(claim: ?Claim, uri?: string) {
|
||||
// 1. parseURI can't resolve a repost's channel, so a `claim` will be needed.
|
||||
// 2. parseURI is still needed to cover the case of abandoned claims.
|
||||
if (claim) {
|
||||
return claim.value_type === 'channel';
|
||||
} else if (uri) {
|
||||
try {
|
||||
return Boolean(parseURI(uri).isChannel);
|
||||
} catch (err) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export function getChannelIdFromClaim(claim: ?Claim) {
|
||||
if (claim) {
|
||||
if (claim.value_type === 'channel') {
|
||||
|
||||
@@ -3,15 +3,3 @@
|
||||
export function toCapitalCase(string: string) {
|
||||
return string.charAt(0).toUpperCase() + string.slice(1);
|
||||
}
|
||||
|
||||
export function toCompactNotation(number: string | number, lang: ?string) {
|
||||
try {
|
||||
return Number(number).toLocaleString(lang || 'en', {
|
||||
compactDisplay: 'short',
|
||||
notation: 'compact',
|
||||
});
|
||||
} catch (err) {
|
||||
// Not all browsers support the addition options.
|
||||
return Number(number).toLocaleString();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user