From f02dcb7fe7487fe36a71a7a2083493d1c1565d43 Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Sat, 19 Jun 2021 10:33:32 +0800 Subject: [PATCH 1/7] No need to resolve as the uri should have all we need --- ui/redux/actions/comments.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/ui/redux/actions/comments.js b/ui/redux/actions/comments.js index d30904438..53f344a6c 100644 --- a/ui/redux/actions/comments.js +++ b/ui/redux/actions/comments.js @@ -566,11 +566,7 @@ function doCommentModToggleBlock( blockerChannelClaims = blockerChannelClaims.filter((x) => blockerIds.includes(x.claim_id)); } - const commenterClaim = selectClaimsByUri(state)[commenterUri]; - if (!commenterClaim) { - console.error("Can't find claim to block"); // eslint-disable-line - return; - } + const { channelName, channelClaimId } = parseURI(commenterUri); const creatorClaim = selectClaimsById(state)[creatorId]; if (creatorId && !creatorClaim) { @@ -587,8 +583,8 @@ function doCommentModToggleBlock( }, }); - const commenterIdForAction = commenterClaim ? commenterClaim.claim_id : null; - const commenterNameForAction = commenterClaim ? commenterClaim.name : null; + const commenterIdForAction = channelClaimId; + const commenterNameForAction = channelName; let channelSignatures = []; -- 2.45.3 From 9f9d0a651b55ec8894878036b83efb567ba75512 Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Sat, 19 Jun 2021 16:28:00 +0800 Subject: [PATCH 2/7] Moderation: resolve chan name or URL instead of using Lighthouse. While Lighthouse allows looser searching like "Tom from LBRY", it doesn't show the expected results when direct channel name with partial ID is entered to disambiguate. --- static/app-strings.json | 2 + ui/component/claimPreview/view.jsx | 8 ++- ui/page/settingsCreator/view.jsx | 89 ++++++++++++++++++++++++------ ui/util/search.js | 70 +++++++++++++++++++++++ 4 files changed, 149 insertions(+), 20 deletions(-) diff --git a/static/app-strings.json b/static/app-strings.json index 390d654ff..8737ec4a2 100644 --- a/static/app-strings.json +++ b/static/app-strings.json @@ -1911,6 +1911,7 @@ "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.": "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.", "Settings unavailable for this channel": "Settings unavailable for this channel", "This channel isn't staking enough LBRY Credits to enable Creator Settings.": "This channel isn't staking enough LBRY Credits to enable Creator Settings.", + "Not a channel (prefix with \"@\", or enter the channel URL)": "Not a channel (prefix with \"@\", or enter the channel URL)", "We apologize for this inconvenience, but have added this additional step to prevent abuse. Users on VPN or shared connections will continue to see this message and are not eligible for Rewards.": "We apologize for this inconvenience, but have added this additional step to prevent abuse. Users on VPN or shared connections will continue to see this message and are not eligible for Rewards.", "Help LBRY Save Crypto": "Help LBRY Save Crypto", "The US government is attempting to destroy the cryptocurrency industry. Can you help?": "The US government is attempting to destroy the cryptocurrency industry. Can you help?", @@ -1994,5 +1995,6 @@ "Item added to Watch Later": "Item added to Watch Later", "Your publish is being confirmed and will be live soon": "Your publish is being confirmed and will be live soon", "Clear Edits": "Clear Edits", + "Something not quite right..": "Something not quite right..", "--end--": "--end--" } diff --git a/ui/component/claimPreview/view.jsx b/ui/component/claimPreview/view.jsx index 835f35b43..a69742968 100644 --- a/ui/component/claimPreview/view.jsx +++ b/ui/component/claimPreview/view.jsx @@ -78,6 +78,7 @@ type Props = { isCollectionMine: boolean, collectionUris: Array, collectionIndex?: number, + disableNavigation?: boolean, }; const ClaimPreview = forwardRef((props: Props, ref: any) => { @@ -134,6 +135,7 @@ const ClaimPreview = forwardRef((props: Props, ref: any) => { editCollection, isCollectionMine, collectionUris, + disableNavigation, } = props; const isRepost = claim && claim.repost_channel_url; const WrapperElement = wrapperElement || 'li'; @@ -214,7 +216,7 @@ const ClaimPreview = forwardRef((props: Props, ref: any) => { onClick(e); } - if (claim && !pending) { + if (claim && !pending && !disableNavigation) { history.push(navigateUrl); } } @@ -423,7 +425,9 @@ const ClaimPreview = forwardRef((props: Props, ref: any) => { )} - {!hideMenu && } + {!hideMenu && ( + + )} ); diff --git a/ui/page/settingsCreator/view.jsx b/ui/page/settingsCreator/view.jsx index cf8b5d5c8..c89a662b2 100644 --- a/ui/page/settingsCreator/view.jsx +++ b/ui/page/settingsCreator/view.jsx @@ -3,13 +3,15 @@ import * as React from 'react'; import Card from 'component/common/card'; import TagsSearch from 'component/tagsSearch'; import Page from 'component/page'; +import Button from 'component/button'; import ChannelSelector from 'component/channelSelector'; import Spinner from 'component/spinner'; import { FormField } from 'component/common/form-components/form-field'; import LbcSymbol from 'component/common/lbc-symbol'; import I18nMessage from 'component/i18nMessage'; -import { parseURI } from 'lbry-redux'; -import WunderBar from 'component/wunderbar'; +import { isNameValid, parseURI } from 'lbry-redux'; +import ClaimPreview from 'component/claimPreview'; +import { getUriForSearchTerm } from 'util/search'; const DEBOUNCE_REFRESH_MS = 1000; @@ -49,6 +51,9 @@ export default function SettingsCreatorPage(props: Props) { const [commentsEnabled, setCommentsEnabled] = React.useState(true); const [mutedWordTags, setMutedWordTags] = React.useState([]); const [moderatorTags, setModeratorTags] = React.useState([]); + const [moderatorSearchTerm, setModeratorSearchTerm] = React.useState(''); + const [moderatorSearchError, setModeratorSearchError] = React.useState(''); + const [moderatorSearchClaimUri, setModeratorSearchClaimUri] = React.useState(''); const [minTipAmountComment, setMinTipAmountComment] = React.useState(0); const [minTipAmountSuperChat, setMinTipAmountSuperChat] = React.useState(0); const [slowModeMinGap, setSlowModeMinGap] = React.useState(0); @@ -142,17 +147,39 @@ export default function SettingsCreatorPage(props: Props) { } } - function handleChannelSearchSelect(value: string) { - let uriInfo; - try { - uriInfo = parseURI(value); - } catch (e) {} - - if (uriInfo && uriInfo.path) { - addModerator([{ name: uriInfo.path }]); + function handleChannelSearchSelect(claim) { + if (claim && claim.name && claim.claim_id) { + addModerator([{ name: claim.name + '#' + claim.claim_id }]); } } + // 'moderatorSearchTerm' to 'moderatorSearchClaimUri' + React.useEffect(() => { + if (!moderatorSearchTerm) { + setModeratorSearchError(''); + setModeratorSearchClaimUri(''); + } else { + const [searchUri, error] = getUriForSearchTerm(moderatorSearchTerm); + setModeratorSearchError(error ? __('Something not quite right..') : ''); + + try { + const { streamName, channelName, isChannel } = parseURI(searchUri); + + if (!isChannel && streamName && isNameValid(streamName)) { + setModeratorSearchError(__('Not a channel (prefix with "@", or enter the channel URL)')); + setModeratorSearchClaimUri(''); + } else if (isChannel && channelName && isNameValid(channelName)) { + setModeratorSearchClaimUri(searchUri); + } + } catch (e) { + if (moderatorSearchTerm !== '@') { + setModeratorSearchError(''); + } + setModeratorSearchClaimUri(''); + } + } + }, [moderatorSearchTerm, setModeratorSearchError]); + // Update local moderator states with data from API. React.useEffect(() => { commentModListDelegates(activeChannelClaim); @@ -318,18 +345,44 @@ export default function SettingsCreatorPage(props: Props) { className="card--enable-overflow" actions={
- - setModeratorSearchTerm(e.target.value)} + error={moderatorSearchError} /> + {moderatorSearchClaimUri && ( +
+ { + return ( +
+ )} { + return term.startsWith('lbry://') ? term : `lbry://${term}`; + }; + + if (wasCopiedFromWeb) { + let prefix = WEB_PROD_PREFIX; + if (includesLbryTvLocal) prefix = WEB_LOCAL_PREFIX; + if (includesLbryTvDev) prefix = WEB_DEV_PREFIX; + if (includesOdysee) prefix = ODYSEE_PREFIX; + + let query = (term && term.slice(prefix.length).replace(/:/g, '#')) || ''; + try { + const lbryUrl = `lbry://${query}`; + parseURI(lbryUrl); + return [lbryUrl, null]; + } catch (e) { + return [query, 'error']; + } + } + + if (!isLbryUrl) { + if (term.startsWith('@')) { + if (isNameValid(term.slice(1))) { + return [term, null]; + } else { + return [term, error]; + } + } + return [addLbryIfNot(term), null]; + } else { + try { + const isValid = isURIValid(term); + if (isValid) { + let uri; + try { + uri = normalizeURI(term); + } catch (e) { + return [term, null]; + } + return [uri, null]; + } else { + return [term, null]; + } + } catch (e) { + return [term, 'error']; + } + } +} -- 2.45.3 From 3db845b9bf97723f1357681f92e196944bfefd89 Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Sat, 19 Jun 2021 17:52:17 +0800 Subject: [PATCH 3/7] Allow creators to assign moderators from a comment context-menu. --- ui/component/commentMenuList/index.js | 3 +++ ui/component/commentMenuList/view.jsx | 24 ++++++++++++++++++ ui/redux/actions/comments.js | 35 ++++++++++++++++++++------- 3 files changed, 53 insertions(+), 9 deletions(-) diff --git a/ui/component/commentMenuList/index.js b/ui/component/commentMenuList/index.js index f549ba9f6..16c197592 100644 --- a/ui/component/commentMenuList/index.js +++ b/ui/component/commentMenuList/index.js @@ -7,6 +7,7 @@ import { doCommentModBlock, doCommentModBlockAsAdmin, doCommentModBlockAsModerator, + doCommentModAddDelegate, } from 'redux/actions/comments'; import { doChannelMute } from 'redux/actions/blocked'; // import { doSetActiveChannel } from 'redux/actions/app'; @@ -36,6 +37,8 @@ const perform = (dispatch) => ({ commentModBlockAsAdmin: (commenterUri, blockerId) => dispatch(doCommentModBlockAsAdmin(commenterUri, blockerId)), commentModBlockAsModerator: (commenterUri, creatorId, blockerId) => dispatch(doCommentModBlockAsModerator(commenterUri, creatorId, blockerId)), + commentModAddDelegate: (modChanId, modChanName, creatorChannelClaim) => + dispatch(doCommentModAddDelegate(modChanId, modChanName, creatorChannelClaim, true)), }); export default connect(select, perform)(CommentMenuList); diff --git a/ui/component/commentMenuList/view.jsx b/ui/component/commentMenuList/view.jsx index cea182f2f..d8c7ce563 100644 --- a/ui/component/commentMenuList/view.jsx +++ b/ui/component/commentMenuList/view.jsx @@ -4,6 +4,7 @@ import React from 'react'; import { MenuList, MenuItem } from '@reach/menu-button'; import ChannelThumbnail from 'component/channelThumbnail'; import Icon from 'component/common/icon'; +import { parseURI } from 'lbry-redux'; type Props = { uri: string, @@ -25,6 +26,7 @@ type Props = { commentModBlock: (string) => void, commentModBlockAsAdmin: (string, string) => void, commentModBlockAsModerator: (string, string, string) => void, + commentModAddDelegate: (string, string, ChannelClaim) => void, playingUri: ?PlayingUri, disableEdit?: boolean, disableRemove?: boolean, @@ -51,6 +53,7 @@ function CommentMenuList(props: Props) { commentModBlock, commentModBlockAsAdmin, commentModBlockAsModerator, + commentModAddDelegate, playingUri, disableEdit, disableRemove, @@ -93,6 +96,13 @@ function CommentMenuList(props: Props) { muteChannel(authorUri); } + function assignAsModerator() { + if (activeChannelClaim && authorUri) { + const { channelName, channelClaimId } = parseURI(authorUri); + commentModAddDelegate(channelClaimId, channelName, activeChannelClaim); + } + } + function blockCommentAsModerator() { if (activeChannelClaim && contentChannelClaim) { commentModBlockAsModerator(authorUri, contentChannelClaim.claim_id, activeChannelClaim.claim_id); @@ -121,6 +131,20 @@ function CommentMenuList(props: Props) { )} + {activeChannelIsCreator && ( + +
+ + {__('Add as moderator')} +
+ + {__('Assign this user to moderate %channel%', { + channel: activeChannelClaim ? activeChannelClaim.name : __('your channel'), + })} + +
+ )} + {!disableRemove && activeChannelClaim && (activeChannelClaim.permanent_url === authorUri || diff --git a/ui/redux/actions/comments.js b/ui/redux/actions/comments.js index 53f344a6c..4b61cb6b1 100644 --- a/ui/redux/actions/comments.js +++ b/ui/redux/actions/comments.js @@ -1,6 +1,7 @@ // @flow import * as ACTIONS from 'constants/action_types'; import * as REACTION_TYPES from 'constants/reactions'; +import * as PAGES from 'constants/pages'; import { BLOCK_LEVEL } from 'constants/comment'; import { Lbry, parseURI, buildURI, selectClaimsById, selectClaimsByUri, selectMyChannelClaims } from 'lbry-redux'; import { doToast, doSeeNotifications } from 'redux/actions/notifications'; @@ -941,7 +942,8 @@ export const doUpdateBlockListForPublishedChannel = (channelClaim: ChannelClaim) export function doCommentModAddDelegate( modChannelId: string, modChannelName: string, - creatorChannelClaim: ChannelClaim + creatorChannelClaim: ChannelClaim, + showToast: boolean = false ) { return async (dispatch: Dispatch, getState: GetState) => { let signature: ?{ @@ -966,14 +968,29 @@ export function doCommentModAddDelegate( creator_channel_name: creatorChannelClaim.name, signature: signature.signature, signing_ts: signature.signing_ts, - }).catch((err) => { - dispatch( - doToast({ - message: err.message, - isError: true, - }) - ); - }); + }) + .then(() => { + if (showToast) { + dispatch( + doToast({ + message: __('Added %user% as moderator for %myChannel%', { + user: modChannelName, + myChannel: creatorChannelClaim.name, + }), + linkText: __('Manage'), + linkTarget: `/${PAGES.SETTINGS_CREATOR}`, + }) + ); + } + }) + .catch((err) => { + dispatch( + doToast({ + message: err.message, + isError: true, + }) + ); + }); }; } -- 2.45.3 From 244f5ecaa40d4a8ead6e84540f24a174cf8fe124 Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Sat, 19 Jun 2021 10:55:44 +0800 Subject: [PATCH 4/7] Fix videos not switching when floating player is up ## Issue 6278 Video doesn't switch when floating player is up ## Notes Not sure why the double `src` call is needed, but it is. --- ui/component/viewers/videoViewer/internal/videojs.jsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ui/component/viewers/videoViewer/internal/videojs.jsx b/ui/component/viewers/videoViewer/internal/videojs.jsx index 52cc59706..95482991b 100644 --- a/ui/component/viewers/videoViewer/internal/videojs.jsx +++ b/ui/component/viewers/videoViewer/internal/videojs.jsx @@ -564,6 +564,12 @@ export default React.memo(function VideoJs(props: Props) { // note: the poster prop seems to return null usually. if (poster) player.poster(poster); + // Update player source + player.src({ + src: finalSource, + type: type, + }); + // set playsinline for mobile player.children_[0].setAttribute('playsinline', ''); -- 2.45.3 From 767c3aa8015a42e980ee092777c48737eeb36da7 Mon Sep 17 00:00:00 2001 From: zeppi Date: Sat, 19 Jun 2021 17:49:00 -0400 Subject: [PATCH 5/7] changelog --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c9af77a73..44650fae6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased for Desktop] ### Added - +- Send a tip with your comment ([#6157](https://github.com/lbryio/lbry-desktop/pull/6157)) +- Channel thumbnails in following side menu ([#6193](https://github.com/lbryio/lbry-desktop/pull/6193)) +- Web is now PWA app ([#6120](https://github.com/lbryio/lbry-desktop/pull/6120)) - Send a tip with your comment ([#5920](https://github.com/lbryio/lbry-desktop/issues/5920)) - Search for tags in search dropdown ([#5876](https://github.com/lbryio/lbry-desktop/issues/5876)) - Japanese, Afrikaans, Filipino, Thai and Vietnamese language support ([#5684](https://github.com/lbryio/lbry-desktop/issues/5684)) -- 2.45.3 From f6b1c58b038e26a8a4ded0bdd53be132bdecaa4f Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Sun, 20 Jun 2021 15:49:34 +0800 Subject: [PATCH 6/7] changelog --- CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 44650fae6..692841a5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,14 +13,24 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Send a tip with your comment ([#5920](https://github.com/lbryio/lbry-desktop/issues/5920)) - Search for tags in search dropdown ([#5876](https://github.com/lbryio/lbry-desktop/issues/5876)) - Japanese, Afrikaans, Filipino, Thai and Vietnamese language support ([#5684](https://github.com/lbryio/lbry-desktop/issues/5684)) +- Brazilian-Portuguese language support ([#5900](https://github.com/lbryio/lbry-desktop/issues/5900)) - Highlight comments made by content owner _community pr!_ ([#5744](https://github.com/lbryio/lbry-desktop/pull/5744)) - Ability to report infringing content directly from the application ([#5808](https://github.com/lbryio/lbry-desktop/pull/5808)) - Re-added ability to export wallet transactions ([#5899](https://github.com/lbryio/lbry-desktop/pull/5899)) +- 24-hour clock setting _community pr!_ ([#5820](https://github.com/lbryio/lbry-desktop/pull/5820)) +- "Related" (recommendations) section: added option to view more from current creator _community pr!_ ([#5847](https://github.com/lbryio/lbry-desktop/pull/5847)) +- Wallet: ability to swap cryptocurrency into LBC ([#5654](https://github.com/lbryio/lbry-desktop/pull/5654)) +- Wallet: ability to send LBC directly to a user through a name or URL search _community pr!_ ([#5990](https://github.com/lbryio/lbry-desktop/pull/5990)) +- Publish: ability to edit the Release Date field ([#6049](https://github.com/lbryio/lbry-desktop/pull/6049)) +- Creator Settings: ability to mute specific words in comments ([#5934](https://github.com/lbryio/lbry-desktop/pull/5934)) +- Creator Settings: ability to disable comments + assign moderators ([#6199](https://github.com/lbryio/lbry-desktop/pull/6199)) +- Additional options in context-menu _community pr!_ ([#6106](https://github.com/lbryio/lbry-desktop/pull/6106)) ### Changed - Keyboard shortcut additions and changes _community pr!_ ([#5717](https://github.com/lbryio/lbry-desktop/pull/5717)) - Removed the 10k character-limit when editing _Posts_ ([#5719](https://github.com/lbryio/lbry-desktop/pull/5719)) +- Improved search functionality (more filters, infinite-scroll, etc.) ([#5742](https://github.com/lbryio/lbry-desktop/pull/5742)) ### Fixed @@ -29,6 +39,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Autoplay looping to a previous video or itself ([#5711](https://github.com/lbryio/lbry-desktop/pull/5711)) - Autoplay not working in mini-player mode ([#5716](https://github.com/lbryio/lbry-desktop/pull/5716)) - Edited claim accidentally moved to 'Anonymous' ([#5767](https://github.com/lbryio/lbry-desktop/pull/5767)) +- Squished "Upload Date" and "View Count" on smaller screens _community pr!_ ([#5823](https://github.com/lbryio/lbry-desktop/pull/5823)) +- Home and End key not working in search bar ([#5867](https://github.com/lbryio/lbry-desktop/pull/5867)) +- Unable to buy paid-Images or Posts ([#6114](https://github.com/lbryio/lbry-desktop/pull/6114)) ## [0.50.2] - [2021-04-2] -- 2.45.3 From 792dbaba5ccd481a2f681949f569b5b173a1b858 Mon Sep 17 00:00:00 2001 From: zeppi Date: Mon, 21 Jun 2021 08:27:02 -0400 Subject: [PATCH 7/7] changelist error --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 692841a5f..a163dba89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased for Desktop] ### Added -- Send a tip with your comment ([#6157](https://github.com/lbryio/lbry-desktop/pull/6157)) +- Private and Publishable Playlists ([#6157](https://github.com/lbryio/lbry-desktop/pull/6157)) - Channel thumbnails in following side menu ([#6193](https://github.com/lbryio/lbry-desktop/pull/6193)) - Web is now PWA app ([#6120](https://github.com/lbryio/lbry-desktop/pull/6120)) - Send a tip with your comment ([#5920](https://github.com/lbryio/lbry-desktop/issues/5920)) -- 2.45.3