Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ed2b5ff1d7 | ||
|
|
05f7e55aed | ||
|
|
bf710cb325 | ||
|
|
7d67c5fdf0 | ||
|
|
b28d95b3bb | ||
|
|
9d97350f09 | ||
|
|
f3a825c0e7 | ||
|
|
c76f6e58ba | ||
|
|
26514f9be6 |
3
flow-typed/Comment.js
vendored
3
flow-typed/Comment.js
vendored
@@ -14,6 +14,9 @@ declare type Comment = {
|
||||
is_pinned: boolean,
|
||||
support_amount: number,
|
||||
replies: number, // number of direct replies (i.e. excluding nested replies).
|
||||
is_moderator: boolean,
|
||||
is_creator: boolean,
|
||||
is_global_mod: boolean,
|
||||
is_fiat?: boolean,
|
||||
};
|
||||
|
||||
|
||||
@@ -1453,6 +1453,7 @@
|
||||
"Unable to comment. This channel has blocked you.": "Unable to comment. This channel has blocked you.",
|
||||
"Unable to comment. Your channel has been blocked by an admin.": "Unable to comment. Your channel has been blocked by an admin.",
|
||||
"Unable to comment. The content owner has disabled comments.": "Unable to comment. The content owner has disabled comments.",
|
||||
"Please do not spam.": "Please do not spam.",
|
||||
"Slow mode is on. Please wait up to %value% seconds before commenting again.": "Slow mode is on. Please wait up to %value% seconds before commenting again.",
|
||||
"The comment contains contents that are blocked by %author%": "The comment contains contents that are blocked by %author%",
|
||||
"Your channel is still being setup, try again in a few moments.": "Your channel is still being setup, try again in a few moments.",
|
||||
@@ -1726,6 +1727,7 @@
|
||||
"Are you sure you want to view this content? Viewing will not unmute @%channel%": "Are you sure you want to view this content? Viewing will not unmute @%channel%",
|
||||
"View Content": "View Content",
|
||||
"Global": "Global",
|
||||
"Global Admin": "Global Admin",
|
||||
"Moderator": "Moderator",
|
||||
"Global Unblock Channel": "Global Unblock Channel",
|
||||
"Global Block Channel": "Global Block Channel",
|
||||
|
||||
@@ -58,6 +58,8 @@ type Analytics = {
|
||||
rewardEligibleEvent: () => void,
|
||||
startupEvent: () => void,
|
||||
purchaseEvent: (number) => void,
|
||||
commentReactionFetchFailedEvent: (string, Array<string>) => void,
|
||||
commentReactionFetchDupEvent: (string, Array<string>) => void,
|
||||
readyEvent: (number) => void,
|
||||
openUrlEvent: (string) => void,
|
||||
};
|
||||
@@ -273,6 +275,14 @@ const analytics: Analytics = {
|
||||
purchaseEvent: (purchaseInt: number) => {
|
||||
sendMatomoEvent('Purchase', 'Purchase-Complete', 'someLabel', purchaseInt);
|
||||
},
|
||||
commentReactionFetchFailedEvent: (claimId: string, commentIds: Array<string>) => {
|
||||
const idCsv = commentIds.map((c) => c.slice(0, 5)).join(',');
|
||||
sendMatomoEvent('Comment', 'Reaction-Fetch-Failed', `${claimId}:${idCsv}`);
|
||||
},
|
||||
commentReactionFetchDupEvent: (claimId: string, commentIds: Array<string>) => {
|
||||
const idCsv = commentIds.map((c) => c.slice(0, 5)).join(',');
|
||||
sendMatomoEvent('Comment', 'Reaction-Fetch-Dup', `${claimId}:${idCsv}`);
|
||||
},
|
||||
};
|
||||
|
||||
function sendMatomoEvent(category, action, name, value) {
|
||||
|
||||
@@ -59,7 +59,9 @@ type Props = {
|
||||
stakedLevel: number,
|
||||
supportAmount: number,
|
||||
numDirectReplies: number,
|
||||
isFiat: boolean
|
||||
isModerator: boolean,
|
||||
isGlobalMod: boolean,
|
||||
isFiat: boolean,
|
||||
};
|
||||
|
||||
const LENGTH_TO_COLLAPSE = 300;
|
||||
@@ -92,6 +94,8 @@ function Comment(props: Props) {
|
||||
stakedLevel,
|
||||
supportAmount,
|
||||
numDirectReplies,
|
||||
isModerator,
|
||||
isGlobalMod,
|
||||
isFiat,
|
||||
} = props;
|
||||
|
||||
@@ -244,6 +248,18 @@ function Comment(props: Props) {
|
||||
|
||||
{supportAmount > 0 && <CreditAmount isFiat={isFiat} amount={supportAmount} superChatLight size={12} />}
|
||||
|
||||
{isGlobalMod && (
|
||||
<span className="comment__badge">
|
||||
<Icon icon={ICONS.BADGE_GLOBAL_MOD} size={20} tooltip customTooltipText={__('Global Admin')} />
|
||||
</span>
|
||||
)}
|
||||
|
||||
{isModerator && (
|
||||
<span className="comment__badge">
|
||||
<Icon icon={ICONS.BADGE_MOD} size={20} tooltip customTooltipText={__('Moderator')} />
|
||||
</span>
|
||||
)}
|
||||
|
||||
{isPinned && (
|
||||
<span className="comment__pin">
|
||||
<Icon icon={ICONS.PIN} size={14} />
|
||||
|
||||
@@ -13,6 +13,7 @@ import usePersistedState from 'effects/use-persisted-state';
|
||||
import { ENABLE_COMMENT_REACTIONS } from 'config';
|
||||
import Empty from 'component/common/empty';
|
||||
import debounce from 'util/debounce';
|
||||
import analytics from 'analytics';
|
||||
|
||||
const DEBOUNCE_SCROLL_HANDLER_MS = 200;
|
||||
|
||||
@@ -76,6 +77,8 @@ function CommentList(props: Props) {
|
||||
const [page, setPage] = React.useState(0);
|
||||
const totalFetchedComments = allCommentIds ? allCommentIds.length : 0;
|
||||
|
||||
const [lastRequestedIds, setLastRequestedIds] = React.useState([]);
|
||||
|
||||
// Display comments immediately if not fetching reactions
|
||||
// If not, wait to show comments until reactions are fetched
|
||||
const [readyToDisplayComments, setReadyToDisplayComments] = React.useState(
|
||||
@@ -137,6 +140,14 @@ function CommentList(props: Props) {
|
||||
}
|
||||
|
||||
if (idsForReactionFetch.length !== 0) {
|
||||
const isEq = (a, b) => a.length === b.length && a.every((value, index) => value === b[index]);
|
||||
if (isEq(idsForReactionFetch, lastRequestedIds)) {
|
||||
const fromScratch = !othersReactsById || !myReactsByCommentId ? 's' : '';
|
||||
analytics.commentReactionFetchDupEvent(`${fromScratch}${activeChannelId || ''}`, idsForReactionFetch);
|
||||
}
|
||||
|
||||
setLastRequestedIds(idsForReactionFetch);
|
||||
|
||||
fetchReacts(idsForReactionFetch)
|
||||
.then(() => {
|
||||
setReadyToDisplayComments(true);
|
||||
@@ -154,6 +165,8 @@ function CommentList(props: Props) {
|
||||
activeChannelId,
|
||||
fetchingChannels,
|
||||
isFetchingReacts,
|
||||
lastRequestedIds,
|
||||
setLastRequestedIds,
|
||||
]);
|
||||
|
||||
// Scroll to linked-comment
|
||||
@@ -301,6 +314,8 @@ function CommentList(props: Props) {
|
||||
isPinned={comment.is_pinned}
|
||||
supportAmount={comment.support_amount}
|
||||
numDirectReplies={comment.replies}
|
||||
isModerator={comment.is_moderator}
|
||||
isGlobalMod={comment.is_global_mod}
|
||||
isFiat={comment.is_fiat}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -97,6 +97,8 @@ function CommentsReplies(props: Props) {
|
||||
commentingEnabled={commentingEnabled}
|
||||
supportAmount={comment.support_amount}
|
||||
numDirectReplies={comment.replies}
|
||||
isModerator={comment.is_moderator}
|
||||
isGlobalMod={comment.is_global_mod}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -2323,4 +2323,34 @@ export const icons = {
|
||||
<path d="M4.954 14.753l3.535 3.535-1.768 1.768-3.535-3.535z" />
|
||||
</g>
|
||||
),
|
||||
[ICONS.BADGE_GLOBAL_MOD]: buildIcon(
|
||||
<g>
|
||||
<path
|
||||
d="M23.25,15.75a7.669,7.669,0,0,1-6,7.5,7.669,7.669,0,0,1-6-7.5v-3a1.5,1.5,0,0,1,1.5-1.5h9a1.5,1.5,0,0,1,1.5,1.5Z"
|
||||
strokeWidth="1.5"
|
||||
/>
|
||||
<path d="M17.25 15L17.25 19.5" strokeWidth="1.5" />
|
||||
<path d="M15 17.25L19.5 17.25" strokeWidth="1.5" />
|
||||
<path d="M11.24,23.225a11.25,11.25,0,1,1,11.362-15" strokeWidth="1.5" />
|
||||
<path d="M9.289,22.921C7.768,20.689,6.75,16.633,6.75,12S7.768,3.312,9.289,1.079" strokeWidth="1.5" />
|
||||
<path d="M0.775 11.25L8.25 11.25" strokeWidth="1.5" />
|
||||
<path d="M2.999 5.25L21 5.25" strokeWidth="1.5" />
|
||||
<path d="M2.048 17.25L8.25 17.25" strokeWidth="1.5" />
|
||||
<path d="M14.711,1.079a17.009,17.009,0,0,1,2.307,7.159" strokeWidth="1.5" />
|
||||
</g>
|
||||
),
|
||||
[ICONS.BADGE_MOD]: buildIcon(
|
||||
<g>
|
||||
<path
|
||||
d="M23.25,15.75a7.668,7.668,0,0,1-6,7.5,7.669,7.669,0,0,1-6-7.5v-3a1.5,1.5,0,0,1,1.5-1.5h9a1.5,1.5,0,0,1,1.5,1.5Z"
|
||||
strokeWidth="1.5"
|
||||
/>
|
||||
<path d="M17.25 15L17.25 19.5" strokeWidth="1.5" />
|
||||
<path d="M15 17.25L19.5 17.25" strokeWidth="1.5" />
|
||||
<path d="M3.000 3.750 A3.000 3.000 0 1 0 9.000 3.750 A3.000 3.000 0 1 0 3.000 3.750 Z" strokeWidth="1.5" />
|
||||
<path d="M9.174,9.317A5.251,5.251,0,0,0,.75,13.5v2.25H3l.75,7.5h4.5L8.7,18.713" strokeWidth="1.5" />
|
||||
<path d="M13.875 3.375 A2.625 2.625 0 1 0 19.125 3.375 A2.625 2.625 0 1 0 13.875 3.375 Z" strokeWidth="1.5" />
|
||||
<path d="M20.4,9a4.5,4.5,0,0,0-7.285-.71" strokeWidth="1.5" />
|
||||
</g>
|
||||
),
|
||||
};
|
||||
|
||||
@@ -20,11 +20,25 @@ type Props = {
|
||||
commentIsMine: boolean,
|
||||
stakedLevel: number,
|
||||
supportAmount: number,
|
||||
isModerator: boolean,
|
||||
isGlobalMod: boolean,
|
||||
isFiat: boolean,
|
||||
};
|
||||
|
||||
function LivestreamComment(props: Props) {
|
||||
const { claim, uri, authorUri, message, commentIsMine, commentId, stakedLevel, supportAmount, isFiat } = props;
|
||||
const {
|
||||
claim,
|
||||
uri,
|
||||
authorUri,
|
||||
message,
|
||||
commentIsMine,
|
||||
commentId,
|
||||
stakedLevel,
|
||||
supportAmount,
|
||||
isModerator,
|
||||
isGlobalMod,
|
||||
isFiat,
|
||||
} = props;
|
||||
const [mouseIsHovering, setMouseHover] = React.useState(false);
|
||||
const commentByOwnerOfContent = claim && claim.signing_channel && claim.signing_channel.permanent_url === authorUri;
|
||||
const { claimName } = parseURI(authorUri);
|
||||
@@ -57,6 +71,18 @@ function LivestreamComment(props: Props) {
|
||||
{claimName}
|
||||
</Button>
|
||||
|
||||
{isGlobalMod && (
|
||||
<span className="comment__badge">
|
||||
<Icon icon={ICONS.BADGE_GLOBAL_MOD} size={16} tooltip customTooltipText={__('Global Admin')} />
|
||||
</span>
|
||||
)}
|
||||
|
||||
{isModerator && (
|
||||
<span className="comment__badge">
|
||||
<Icon icon={ICONS.BADGE_MOD} size={16} tooltip customTooltipText={__('Moderator')} />
|
||||
</span>
|
||||
)}
|
||||
|
||||
<div className="livestream-comment__text">
|
||||
<MarkdownPreview content={message} promptLinks stakedLevel={stakedLevel} />
|
||||
</div>
|
||||
|
||||
@@ -197,6 +197,8 @@ export default function LivestreamComments(props: Props) {
|
||||
commentId={comment.comment_id}
|
||||
message={comment.comment}
|
||||
supportAmount={comment.support_amount}
|
||||
isModerator={comment.is_moderator}
|
||||
isGlobalMod={comment.is_global_mod}
|
||||
isFiat={comment.is_fiat}
|
||||
commentIsMine={comment.channel_id && isMyComment(comment.channel_id)}
|
||||
/>
|
||||
|
||||
@@ -165,3 +165,5 @@ export const GLOBE = 'globe';
|
||||
export const RSS = 'rss';
|
||||
export const STAR = 'star';
|
||||
export const MUSIC = 'MusicCategory';
|
||||
export const BADGE_GLOBAL_MOD = 'BadgeGlobalMod';
|
||||
export const BADGE_MOD = 'BadgeMod';
|
||||
|
||||
@@ -28,11 +28,15 @@ import I18nMessage from 'component/i18nMessage';
|
||||
import PlaceholderTx from 'static/img/placeholderTx.gif';
|
||||
|
||||
export const PAGE_VIEW_QUERY = `view`;
|
||||
const CONTENT_PAGE = 'content';
|
||||
const LISTS_PAGE = 'lists';
|
||||
const ABOUT_PAGE = `about`;
|
||||
export const DISCUSSION_PAGE = `discussion`;
|
||||
const EDIT_PAGE = 'edit';
|
||||
|
||||
const PAGE = {
|
||||
CONTENT: 'content',
|
||||
LISTS: 'lists',
|
||||
ABOUT: 'about',
|
||||
DISCUSSION: DISCUSSION_PAGE,
|
||||
EDIT: 'edit',
|
||||
};
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
@@ -83,9 +87,9 @@ function ChannelPage(props: Props) {
|
||||
} = useHistory();
|
||||
const [viewBlockedChannel, setViewBlockedChannel] = React.useState(false);
|
||||
const urlParams = new URLSearchParams(search);
|
||||
const currentView = urlParams.get(PAGE_VIEW_QUERY) || undefined;
|
||||
const currentView = urlParams.get(PAGE_VIEW_QUERY) || PAGE.CONTENT;
|
||||
const [discussionWasMounted, setDiscussionWasMounted] = React.useState(false);
|
||||
const editing = urlParams.get(PAGE_VIEW_QUERY) === EDIT_PAGE;
|
||||
const editing = urlParams.get(PAGE_VIEW_QUERY) === PAGE.EDIT;
|
||||
const { channelName } = parseURI(uri);
|
||||
const { permanent_url: permanentUrl } = claim;
|
||||
const claimId = claim.claim_id;
|
||||
@@ -143,16 +147,16 @@ function ChannelPage(props: Props) {
|
||||
// would alter the Tab label's role attribute, which should stay role="tab" to work with keyboards/screen readers.
|
||||
let tabIndex;
|
||||
switch (currentView) {
|
||||
case CONTENT_PAGE:
|
||||
case PAGE.CONTENT:
|
||||
tabIndex = 0;
|
||||
break;
|
||||
case LISTS_PAGE:
|
||||
case PAGE.LISTS:
|
||||
tabIndex = 1;
|
||||
break;
|
||||
case ABOUT_PAGE:
|
||||
case PAGE.ABOUT:
|
||||
tabIndex = 2;
|
||||
break;
|
||||
case DISCUSSION_PAGE:
|
||||
case PAGE.DISCUSSION:
|
||||
tabIndex = 3;
|
||||
break;
|
||||
default:
|
||||
@@ -165,20 +169,20 @@ function ChannelPage(props: Props) {
|
||||
let search = '?';
|
||||
|
||||
if (newTabIndex === 0) {
|
||||
search += `${PAGE_VIEW_QUERY}=${CONTENT_PAGE}`;
|
||||
search += `${PAGE_VIEW_QUERY}=${PAGE.CONTENT}`;
|
||||
} else if (newTabIndex === 1) {
|
||||
search += `${PAGE_VIEW_QUERY}=${LISTS_PAGE}`;
|
||||
search += `${PAGE_VIEW_QUERY}=${PAGE.LISTS}`;
|
||||
} else if (newTabIndex === 2) {
|
||||
search += `${PAGE_VIEW_QUERY}=${ABOUT_PAGE}`;
|
||||
search += `${PAGE_VIEW_QUERY}=${PAGE.ABOUT}`;
|
||||
} else {
|
||||
search += `${PAGE_VIEW_QUERY}=${DISCUSSION_PAGE}`;
|
||||
search += `${PAGE_VIEW_QUERY}=${PAGE.DISCUSSION}`;
|
||||
}
|
||||
|
||||
push(`${url}${search}`);
|
||||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
if (currentView === DISCUSSION_PAGE) {
|
||||
if (currentView === PAGE.DISCUSSION) {
|
||||
setDiscussionWasMounted(true);
|
||||
}
|
||||
}, [currentView]);
|
||||
@@ -241,7 +245,7 @@ function ChannelPage(props: Props) {
|
||||
<Button
|
||||
button="alt"
|
||||
title={__('Edit')}
|
||||
onClick={() => push(`?${PAGE_VIEW_QUERY}=${EDIT_PAGE}`)}
|
||||
onClick={() => push(`?${PAGE_VIEW_QUERY}=${PAGE.EDIT}`)}
|
||||
icon={ICONS.EDIT}
|
||||
iconSize={18}
|
||||
disabled={pending}
|
||||
@@ -284,27 +288,31 @@ function ChannelPage(props: Props) {
|
||||
</TabList>
|
||||
<TabPanels>
|
||||
<TabPanel>
|
||||
<ChannelContent
|
||||
uri={uri}
|
||||
channelIsBlackListed={channelIsBlackListed}
|
||||
viewHiddenChannels
|
||||
empty={<section className="main--empty">{__('No Content Found')}</section>}
|
||||
/>
|
||||
{currentView === PAGE.CONTENT && (
|
||||
<ChannelContent
|
||||
uri={uri}
|
||||
channelIsBlackListed={channelIsBlackListed}
|
||||
viewHiddenChannels
|
||||
empty={<section className="main--empty">{__('No Content Found')}</section>}
|
||||
/>
|
||||
)}
|
||||
</TabPanel>
|
||||
<TabPanel>
|
||||
<ChannelContent
|
||||
claimType={'collection'}
|
||||
uri={uri}
|
||||
channelIsBlackListed={channelIsBlackListed}
|
||||
viewHiddenChannels
|
||||
empty={collectionEmpty}
|
||||
/>
|
||||
{currentView === PAGE.LISTS && (
|
||||
<ChannelContent
|
||||
claimType={'collection'}
|
||||
uri={uri}
|
||||
channelIsBlackListed={channelIsBlackListed}
|
||||
viewHiddenChannels
|
||||
empty={collectionEmpty}
|
||||
/>
|
||||
)}
|
||||
</TabPanel>
|
||||
<TabPanel>
|
||||
<ChannelAbout uri={uri} />
|
||||
</TabPanel>
|
||||
<TabPanel>
|
||||
{(discussionWasMounted || currentView === DISCUSSION_PAGE) && <ChannelDiscussion uri={uri} />}
|
||||
{(discussionWasMounted || currentView === PAGE.DISCUSSION) && <ChannelDiscussion uri={uri} />}
|
||||
</TabPanel>
|
||||
</TabPanels>
|
||||
</Tabs>
|
||||
|
||||
@@ -15,7 +15,9 @@ import { getUriForSearchTerm } from 'util/search';
|
||||
|
||||
const DEBOUNCE_REFRESH_MS = 1000;
|
||||
|
||||
const FEATURE_IS_READY = false;
|
||||
const BTC_SATOSHIS = 100000000;
|
||||
const LBC_MAX = 21000000;
|
||||
const LBC_MIN = 1;
|
||||
|
||||
type Props = {
|
||||
activeChannelClaim: ChannelClaim,
|
||||
@@ -297,47 +299,46 @@ export default function SettingsCreatorPage(props: Props) {
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
{FEATURE_IS_READY && (
|
||||
<Card
|
||||
title={__('Tip')}
|
||||
actions={
|
||||
<>
|
||||
<FormField
|
||||
name="min_tip_amount_comment"
|
||||
label={
|
||||
<I18nMessage tokens={{ lbc: <LbcSymbol /> }}>Minimum %lbc% tip amount for comments</I18nMessage>
|
||||
}
|
||||
helper={__(
|
||||
'Enabling a minimum amount to comment will force all comments, including livestreams, to have tips associated with them. This can help prevent spam.'
|
||||
)}
|
||||
className="form-field--price-amount"
|
||||
min={0}
|
||||
step="any"
|
||||
type="number"
|
||||
placeholder="1"
|
||||
value={minTipAmountComment}
|
||||
onChange={(e) => setSettings({ min_tip_amount_comment: parseFloat(e.target.value) })}
|
||||
/>
|
||||
<FormField
|
||||
name="min_tip_amount_super_chat"
|
||||
label={
|
||||
<I18nMessage tokens={{ lbc: <LbcSymbol /> }}>Minimum %lbc% tip amount for hyperchats</I18nMessage>
|
||||
}
|
||||
helper={__(
|
||||
'Enabling a minimum amount to hyperchat will force all TIPPED comments to have this value in order to be shown. This still allows regular comments to be posted.'
|
||||
)}
|
||||
className="form-field--price-amount"
|
||||
min={0}
|
||||
step="any"
|
||||
type="number"
|
||||
placeholder="1"
|
||||
value={minTipAmountSuperChat}
|
||||
onChange={(e) => setSettings({ min_tip_amount_super_chat: parseFloat(e.target.value) })}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
<Card
|
||||
title={__('Tip')}
|
||||
actions={
|
||||
<>
|
||||
<FormField
|
||||
name="min_tip_amount_comment"
|
||||
label={
|
||||
<I18nMessage tokens={{ lbc: <LbcSymbol /> }}>Minimum %lbc% tip amount for comments</I18nMessage>
|
||||
}
|
||||
helper={__(
|
||||
'Enabling a minimum amount to comment will force all comments, including livestreams, to have tips associated with them. This can help prevent spam.'
|
||||
)}
|
||||
className="form-field--price-amount"
|
||||
max={LBC_MAX}
|
||||
min={LBC_MIN}
|
||||
step={1 / BTC_SATOSHIS}
|
||||
type="number"
|
||||
placeholder="3.14"
|
||||
value={minTipAmountComment}
|
||||
onChange={(e) => setSettings({ min_tip_amount_comment: parseFloat(e.target.value) })}
|
||||
/>
|
||||
<FormField
|
||||
name="min_tip_amount_super_chat"
|
||||
label={
|
||||
<I18nMessage tokens={{ lbc: <LbcSymbol /> }}>Minimum %lbc% tip amount for hyperchats</I18nMessage>
|
||||
}
|
||||
helper={__(
|
||||
'Enabling a minimum amount to hyperchat will force all TIPPED comments to have this value in order to be shown. This still allows regular comments to be posted.'
|
||||
)}
|
||||
className="form-field--price-amount"
|
||||
min={0}
|
||||
step="any"
|
||||
type="number"
|
||||
placeholder="1"
|
||||
value={minTipAmountSuperChat}
|
||||
onChange={(e) => setSettings({ min_tip_amount_super_chat: parseFloat(e.target.value) })}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
<Card
|
||||
title={__('Delegation')}
|
||||
className="card--enable-overflow"
|
||||
|
||||
@@ -20,6 +20,7 @@ import {
|
||||
selectModerationBlockList,
|
||||
selectModerationDelegatorsById,
|
||||
} from 'redux/selectors/comments';
|
||||
import analytics from 'analytics';
|
||||
import { makeSelectNotificationForCommentId } from 'redux/selectors/notifications';
|
||||
import { selectActiveChannelClaim } from 'redux/selectors/app';
|
||||
import { toHex } from 'util/hex';
|
||||
@@ -247,6 +248,7 @@ export function doCommentReactList(commentIds: Array<string>) {
|
||||
})
|
||||
.catch((error) => {
|
||||
devToast(dispatch, `doCommentReactList: ${error.message}`);
|
||||
analytics.commentReactionFetchFailedEvent(activeChannelClaim ? activeChannelClaim.claim_id : '', commentIds);
|
||||
dispatch({
|
||||
type: ACTIONS.COMMENT_REACTION_LIST_FAILED,
|
||||
data: error,
|
||||
@@ -470,6 +472,9 @@ export function doCommentCreate(
|
||||
case 'comments are disabled by the creator':
|
||||
toastMessage = __('Unable to comment. The content owner has disabled comments.');
|
||||
break;
|
||||
case 'duplicate comment!':
|
||||
toastMessage = __('Please do not spam.');
|
||||
break;
|
||||
default:
|
||||
const BLOCKED_WORDS_ERR_MSG = 'the comment contents are blocked by';
|
||||
const SLOW_MODE_PARTIAL_ERR_MSG = 'Slow mode is on. Please wait at most';
|
||||
@@ -1445,21 +1450,21 @@ export const doFetchCreatorSettings = (channelClaimIds: Array<string> = []) => {
|
||||
*/
|
||||
export const doUpdateCreatorSettings = (channelClaim: ChannelClaim, settings: PerChannelSettings) => {
|
||||
return async (dispatch: Dispatch, getState: GetState) => {
|
||||
let channelSignature: ?{
|
||||
signature: string,
|
||||
signing_ts: string,
|
||||
};
|
||||
try {
|
||||
channelSignature = await Lbry.channel_sign({
|
||||
channel_id: channelClaim.claim_id,
|
||||
hexdata: toHex(channelClaim.name),
|
||||
});
|
||||
} catch (e) {}
|
||||
|
||||
const channelSignature = await channelSignName(channelClaim.claim_id, channelClaim.name);
|
||||
if (!channelSignature) {
|
||||
devToast(dispatch, 'doUpdateCreatorSettings: failed to sign channel name');
|
||||
return;
|
||||
}
|
||||
|
||||
const BTC_SATOSHIS = 100000000;
|
||||
|
||||
if (settings.min_tip_amount_comment !== undefined) {
|
||||
settings.min_tip_amount_comment *= BTC_SATOSHIS;
|
||||
}
|
||||
if (settings.min_tip_amount_super_chat !== undefined) {
|
||||
settings.min_tip_amount_super_chat *= BTC_SATOSHIS;
|
||||
}
|
||||
|
||||
return Comments.setting_update({
|
||||
channel_name: channelClaim.name,
|
||||
channel_id: channelClaim.claim_id,
|
||||
@@ -1467,12 +1472,7 @@ export const doUpdateCreatorSettings = (channelClaim: ChannelClaim, settings: Pe
|
||||
signing_ts: channelSignature.signing_ts,
|
||||
...settings,
|
||||
}).catch((err) => {
|
||||
dispatch(
|
||||
doToast({
|
||||
message: err.message,
|
||||
isError: true,
|
||||
})
|
||||
);
|
||||
dispatch(doToast({ message: err.message, isError: true }));
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
@@ -991,9 +991,22 @@ export default handleActions(
|
||||
// because the GUI only shows 1 channel's setting at a time, and *always*
|
||||
// re-fetches to get latest data before displaying. Either rename this to
|
||||
// 'activeChannelCreatorSettings', or append the new data properly.
|
||||
const settingsByChannelId = Object.assign({}, action.data);
|
||||
const BTC_SATOSHIS = 100000000;
|
||||
|
||||
const channelIds = Object.keys(settingsByChannelId);
|
||||
channelIds.forEach((ci) => {
|
||||
if (settingsByChannelId[ci].min_tip_amount_comment) {
|
||||
settingsByChannelId[ci].min_tip_amount_comment /= BTC_SATOSHIS;
|
||||
}
|
||||
if (settingsByChannelId[ci].min_tip_amount_super_chat) {
|
||||
settingsByChannelId[ci].min_tip_amount_super_chat /= BTC_SATOSHIS;
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
...state,
|
||||
settingsByChannelId: action.data,
|
||||
settingsByChannelId,
|
||||
fetchingSettings: false,
|
||||
};
|
||||
},
|
||||
|
||||
@@ -215,6 +215,14 @@ $thumbnailWidthSmall: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.comment__badge {
|
||||
margin-left: var(--spacing-xxs);
|
||||
|
||||
.icon {
|
||||
color: var(--color-primary);
|
||||
}
|
||||
}
|
||||
|
||||
.comment__message {
|
||||
word-break: break-word;
|
||||
max-width: 35rem;
|
||||
|
||||
@@ -19,11 +19,7 @@ export function getThumbnailCdnUrl(props: Props) {
|
||||
return thumbnail;
|
||||
}
|
||||
|
||||
if (thumbnail && !thumbnail.includes('https://spee.ch')) {
|
||||
if (thumbnail) {
|
||||
return `${THUMBNAIL_CDN_URL}s:${width}:${height}/quality:${quality}/plain/${thumbnail}`;
|
||||
}
|
||||
|
||||
if (thumbnail && thumbnail.includes('https://spee.ch')) {
|
||||
return `${thumbnail}?quality=${quality}&height=${height}&width=${width}`;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user