1
0
Fork 0
forked from gitea/nas

Add new filter action to blur media (#34256)

This commit is contained in:
Claire 2025-03-26 08:31:05 +01:00 committed by GitHub
parent 2a181f56e3
commit c93b2c6809
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 46 additions and 11 deletions

View file

@ -62,6 +62,7 @@ class Audio extends PureComponent {
volume: PropTypes.number,
muted: PropTypes.bool,
deployPictureInPicture: PropTypes.func,
matchedFilters: PropTypes.arrayOf(PropTypes.string),
};
state = {
@ -472,7 +473,7 @@ class Audio extends PureComponent {
};
render () {
const { src, intl, alt, lang, editable, autoPlay, sensitive, blurhash } = this.props;
const { src, intl, alt, lang, editable, autoPlay, sensitive, blurhash, matchedFilters } = this.props;
const { paused, volume, currentTime, duration, buffer, dragging, revealed } = this.state;
const progress = Math.min((currentTime / duration) * 100, 100);
const muted = this.state.muted || volume === 0;
@ -514,7 +515,7 @@ class Audio extends PureComponent {
lang={lang}
/>
<SpoilerButton hidden={revealed || editable} sensitive={sensitive} onClick={this.toggleReveal} />
<SpoilerButton hidden={revealed || editable} sensitive={sensitive} onClick={this.toggleReveal} matchedFilters={matchedFilters} />
{(revealed || editable) && <img
src={this.props.poster}

View file

@ -175,6 +175,7 @@ export const DetailedStatus: React.FC<{
onOpenMedia={onOpenMedia}
visible={showMedia}
onToggleVisibility={onToggleMediaVisibility}
matchedFilters={status.get('matched_media_filters')}
/>
);
} else if (status.getIn(['media_attachments', 0, 'type']) === 'audio') {
@ -201,6 +202,7 @@ export const DetailedStatus: React.FC<{
blurhash={attachment.get('blurhash')}
height={150}
onToggleVisibility={onToggleMediaVisibility}
matchedFilters={status.get('matched_media_filters')}
/>
);
} else if (status.getIn(['media_attachments', 0, 'type']) === 'video') {
@ -224,6 +226,7 @@ export const DetailedStatus: React.FC<{
sensitive={status.get('sensitive')}
visible={showMedia}
onToggleVisibility={onToggleMediaVisibility}
matchedFilters={status.get('matched_media_filters')}
/>
);
}

View file

@ -136,6 +136,7 @@ class Video extends PureComponent {
muted: PropTypes.bool,
componentIndex: PropTypes.number,
autoFocus: PropTypes.bool,
matchedFilters: PropTypes.arrayOf(PropTypes.string),
};
static defaultProps = {
@ -535,7 +536,7 @@ class Video extends PureComponent {
}
render () {
const { preview, src, aspectRatio, onOpenVideo, onCloseVideo, intl, alt, lang, detailed, sensitive, editable, blurhash, autoFocus } = this.props;
const { preview, src, aspectRatio, onOpenVideo, onCloseVideo, intl, alt, lang, detailed, sensitive, editable, blurhash, autoFocus, matchedFilters } = this.props;
const { currentTime, duration, volume, buffer, dragging, paused, fullscreen, hovered, revealed } = this.state;
const progress = Math.min((currentTime / duration) * 100, 100);
const muted = this.state.muted || volume === 0;
@ -592,7 +593,7 @@ class Video extends PureComponent {
style={{ width: '100%' }}
/>}
<SpoilerButton hidden={revealed || editable} sensitive={sensitive} onClick={this.toggleReveal} />
<SpoilerButton hidden={revealed || editable} sensitive={sensitive} onClick={this.toggleReveal} matchedFilters={matchedFilters} />
<div className={classNames('video-player__controls', { active: paused || hovered })}>
<div className='video-player__seek' onMouseDown={this.handleMouseDown} ref={this.setSeekRef}>