Change to display media thumbnails in notifications
This commit is contained in:
parent
11a784735a
commit
1f0d4cdd16
1 changed files with 21 additions and 9 deletions
|
@ -13,7 +13,7 @@ import AccountActionBar from './account_action_bar';
|
||||||
import Card from '../features/status/components/card';
|
import Card from '../features/status/components/card';
|
||||||
import { injectIntl, defineMessages, FormattedMessage } from 'react-intl';
|
import { injectIntl, defineMessages, FormattedMessage } from 'react-intl';
|
||||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||||
import { MediaGallery, Video, Audio } from '../features/ui/util/async-components';
|
import { MediaGallery, Video, Audio, ThumbnailGallery } from '../features/ui/util/async-components';
|
||||||
import { HotKeys } from 'react-hotkeys';
|
import { HotKeys } from 'react-hotkeys';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import Icon from 'mastodon/components/icon';
|
import Icon from 'mastodon/components/icon';
|
||||||
|
@ -271,6 +271,10 @@ class Status extends ImmutablePureComponent {
|
||||||
return <div className='audio-player' style={{ height: '110px' }} />;
|
return <div className='audio-player' style={{ height: '110px' }} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
renderLoadingThumbnailGallery () {
|
||||||
|
return <div className='thumbnail-gallery' style={{ height: '20px' }} />;
|
||||||
|
}
|
||||||
|
|
||||||
handleOpenVideo = (options) => {
|
handleOpenVideo = (options) => {
|
||||||
const status = this._properStatus();
|
const status = this._properStatus();
|
||||||
this.props.onOpenVideo(status.get('id'), status.getIn(['media_attachments', 0]), options);
|
this.props.onOpenVideo(status.get('id'), status.getIn(['media_attachments', 0]), options);
|
||||||
|
@ -469,10 +473,14 @@ class Status extends ImmutablePureComponent {
|
||||||
media = <PictureInPicturePlaceholder width={this.props.cachedMediaWidth} />;
|
media = <PictureInPicturePlaceholder width={this.props.cachedMediaWidth} />;
|
||||||
} else if (this.props.muted) {
|
} else if (this.props.muted) {
|
||||||
media = (
|
media = (
|
||||||
<AttachmentList
|
<Bundle fetchComponent={ThumbnailGallery} loading={this.renderLoadingThumbnailGallery}>
|
||||||
compact
|
{Component => (
|
||||||
media={status.get('media_attachments')}
|
<Component
|
||||||
/>
|
media={status.get('media_attachments')}
|
||||||
|
sensitive={status.get('sensitive')}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</Bundle>
|
||||||
);
|
);
|
||||||
} else if (status.getIn(['media_attachments', 0, 'type']) === 'audio') {
|
} else if (status.getIn(['media_attachments', 0, 'type']) === 'audio') {
|
||||||
const attachment = status.getIn(['media_attachments', 0]);
|
const attachment = status.getIn(['media_attachments', 0]);
|
||||||
|
@ -573,10 +581,14 @@ class Status extends ImmutablePureComponent {
|
||||||
quote_media = <PictureInPicturePlaceholder width={this.props.cachedMediaWidth} />;
|
quote_media = <PictureInPicturePlaceholder width={this.props.cachedMediaWidth} />;
|
||||||
} else if (this.props.muted) {
|
} else if (this.props.muted) {
|
||||||
quote_media = (
|
quote_media = (
|
||||||
<AttachmentList
|
<Bundle fetchComponent={ThumbnailGallery} loading={this.renderLoadingThumbnailGallery}>
|
||||||
compact
|
{Component => (
|
||||||
media={quote_status.get('media_attachments')}
|
<Component
|
||||||
/>
|
media={quote_status.get('media_attachments')}
|
||||||
|
sensitive={quote_status.get('sensitive')}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</Bundle>
|
||||||
);
|
);
|
||||||
} else if (quote_status.getIn(['media_attachments', 0, 'type']) === 'audio') {
|
} else if (quote_status.getIn(['media_attachments', 0, 'type']) === 'audio') {
|
||||||
const attachment = quote_status.getIn(['media_attachments', 0]);
|
const attachment = quote_status.getIn(['media_attachments', 0]);
|
||||||
|
|
Loading…
Reference in a new issue