Only apply Staked Levels to Comments (allow it in Posts)

Blocking videos and images was too limiting, plus the system was intended to block spammy comments in the first place.
This commit is contained in:
infinite-persistence 2021-04-09 01:59:22 +08:00 committed by Sean Yesmunt
parent 5bc462927a
commit fb839b92ef
5 changed files with 7 additions and 17 deletions

View file

@ -1,10 +1,9 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { makeSelectMetadataItemForUri, makeSelectClaimForUri, makeSelectStakedLevelForChannelUri } from 'lbry-redux'; import { makeSelectMetadataItemForUri, makeSelectClaimForUri } from 'lbry-redux';
import ChannelAbout from './view'; import ChannelAbout from './view';
const select = (state, props) => ({ const select = (state, props) => ({
claim: makeSelectClaimForUri(props.uri)(state), claim: makeSelectClaimForUri(props.uri)(state),
stakedLevel: makeSelectStakedLevelForChannelUri(props.uri)(state),
description: makeSelectMetadataItemForUri(props.uri, 'description')(state), description: makeSelectMetadataItemForUri(props.uri, 'description')(state),
website: makeSelectMetadataItemForUri(props.uri, 'website_url')(state), website: makeSelectMetadataItemForUri(props.uri, 'website_url')(state),
email: makeSelectMetadataItemForUri(props.uri, 'email')(state), email: makeSelectMetadataItemForUri(props.uri, 'email')(state),

View file

@ -17,7 +17,6 @@ type Props = {
email: ?string, email: ?string,
website: ?string, website: ?string,
languages: Array<string>, languages: Array<string>,
stakedLevel?: number,
}; };
const formatEmail = (email: string) => { const formatEmail = (email: string) => {
@ -30,7 +29,7 @@ const formatEmail = (email: string) => {
}; };
function ChannelAbout(props: Props) { function ChannelAbout(props: Props) {
const { claim, uri, description, email, website, languages, stakedLevel } = props; const { claim, uri, description, email, website, languages } = props;
const claimId = claim && claim.claim_id; const claimId = claim && claim.claim_id;
return ( return (
@ -41,7 +40,7 @@ function ChannelAbout(props: Props) {
<> <>
<label>{__('Description')}</label> <label>{__('Description')}</label>
<div className="media__info-text media__info-text--constrained"> <div className="media__info-text media__info-text--constrained">
<MarkdownPreview content={description} stakedLevel={stakedLevel} /> <MarkdownPreview content={description} />
</div> </div>
</> </>
)} )}

View file

@ -6,8 +6,6 @@ import {
makeSelectDownloadPathForUri, makeSelectDownloadPathForUri,
makeSelectStreamingUrlForUri, makeSelectStreamingUrlForUri,
SETTINGS, SETTINGS,
makeSelectStakedLevelForChannelUri,
makeSelectChannelForClaimUri,
} from 'lbry-redux'; } from 'lbry-redux';
import { makeSelectClientSetting } from 'redux/selectors/settings'; import { makeSelectClientSetting } from 'redux/selectors/settings';
import { makeSelectFileRenderModeForUri, makeSelectFileExtensionForUri } from 'redux/selectors/content'; import { makeSelectFileRenderModeForUri, makeSelectFileExtensionForUri } from 'redux/selectors/content';
@ -15,11 +13,9 @@ import FileRender from './view';
const select = (state, props) => { const select = (state, props) => {
const autoplay = props.embedded ? false : makeSelectClientSetting(SETTINGS.AUTOPLAY)(state); const autoplay = props.embedded ? false : makeSelectClientSetting(SETTINGS.AUTOPLAY)(state);
const channelUri = makeSelectChannelForClaimUri(props.uri)(state);
return { return {
currentTheme: makeSelectClientSetting(SETTINGS.THEME)(state), currentTheme: makeSelectClientSetting(SETTINGS.THEME)(state),
claim: makeSelectClaimForUri(props.uri)(state), claim: makeSelectClaimForUri(props.uri)(state),
stakedLevel: makeSelectStakedLevelForChannelUri(channelUri)(state),
thumbnail: makeSelectThumbnailForUri(props.uri)(state), thumbnail: makeSelectThumbnailForUri(props.uri)(state),
contentType: makeSelectContentTypeForUri(props.uri)(state), contentType: makeSelectContentTypeForUri(props.uri)(state),
downloadPath: makeSelectDownloadPathForUri(props.uri)(state), downloadPath: makeSelectDownloadPathForUri(props.uri)(state),

View file

@ -35,7 +35,6 @@ type Props = {
thumbnail: string, thumbnail: string,
desktopPlayStartTime?: number, desktopPlayStartTime?: number,
className?: string, className?: string,
stakedLevel?: number,
}; };
class FileRender extends React.PureComponent<Props> { class FileRender extends React.PureComponent<Props> {
@ -79,7 +78,6 @@ class FileRender extends React.PureComponent<Props> {
uri, uri,
renderMode, renderMode,
desktopPlayStartTime, desktopPlayStartTime,
stakedLevel,
} = this.props; } = this.props;
const source = streamingUrl; const source = streamingUrl;
@ -104,7 +102,7 @@ class FileRender extends React.PureComponent<Props> {
<DocumentViewer <DocumentViewer
source={{ source={{
// @if TARGET='app' // @if TARGET='app'
file: options => fs.createReadStream(downloadPath, options), file: (options) => fs.createReadStream(downloadPath, options),
// @endif // @endif
stream: source, stream: source,
fileExtension, fileExtension,
@ -112,7 +110,6 @@ class FileRender extends React.PureComponent<Props> {
}} }}
renderMode={renderMode} renderMode={renderMode}
theme={currentTheme} theme={currentTheme}
stakedLevel={stakedLevel}
/> />
); );
case RENDER_MODES.DOCX: case RENDER_MODES.DOCX:
@ -134,7 +131,7 @@ class FileRender extends React.PureComponent<Props> {
<ComicBookViewer <ComicBookViewer
source={{ source={{
// @if TARGET='app' // @if TARGET='app'
file: options => fs.createReadStream(downloadPath, options), file: (options) => fs.createReadStream(downloadPath, options),
// @endif // @endif
stream: source, stream: source,
}} }}

View file

@ -15,7 +15,6 @@ type Props = {
stream: string, stream: string,
contentType: string, contentType: string,
}, },
stakedLevel?: number,
}; };
type State = { type State = {
@ -76,11 +75,11 @@ class DocumentViewer extends React.PureComponent<Props, State> {
renderDocument() { renderDocument() {
const { content } = this.state; const { content } = this.state;
const { source, theme, renderMode, stakedLevel } = this.props; const { source, theme, renderMode } = this.props;
const { contentType } = source; const { contentType } = source;
return renderMode === RENDER_MODES.MARKDOWN ? ( return renderMode === RENDER_MODES.MARKDOWN ? (
<MarkdownPreview content={content} isMarkdownPost promptLinks stakedLevel={stakedLevel} /> <MarkdownPreview content={content} isMarkdownPost promptLinks />
) : ( ) : (
<CodeViewer value={content} contentType={contentType} theme={theme} /> <CodeViewer value={content} contentType={contentType} theme={theme} />
); );