summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2020-11-27 15:41:58 +0100
committerGitHub <noreply@github.com>2020-11-27 15:41:58 +0100
commite1a6526c8dccec4464667b422cc2336b28504d2c (patch)
tree233ec5fb9d70dbd7482c00cd86b5da419667f717
parentec0edf74d672146ea41fabe17f8e2c4e8eaf7459 (diff)
Fix media modal regression on public pages (#15221)
-rw-r--r--app/javascript/mastodon/containers/media_container.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/app/javascript/mastodon/containers/media_container.js b/app/javascript/mastodon/containers/media_container.js
index ba55ecbc7ba..afed6868e12 100644
--- a/app/javascript/mastodon/containers/media_container.js
+++ b/app/javascript/mastodon/containers/media_container.js
@@ -30,6 +30,7 @@ export default class MediaContainer extends PureComponent {
media: null,
index: null,
time: null,
+ backgroundColor: null,
};
handleOpenMedia = (media, index) => {
@@ -52,7 +53,16 @@ export default class MediaContainer extends PureComponent {
document.body.classList.remove('with-modals--active');
document.documentElement.style.marginRight = 0;
- this.setState({ media: null, index: null, time: null });
+ this.setState({
+ media: null,
+ index: null,
+ time: null,
+ backgroundColor: null,
+ });
+ }
+
+ setBackgroundColor = color => {
+ this.setState({ backgroundColor: color });
}
render () {
@@ -85,13 +95,14 @@ export default class MediaContainer extends PureComponent {
);
})}
- <ModalRoot onClose={this.handleCloseMedia}>
+ <ModalRoot backgroundColor={this.state.backgroundColor} onClose={this.handleCloseMedia}>
{this.state.media && (
<MediaModal
media={this.state.media}
index={this.state.index || 0}
time={this.state.time}
onClose={this.handleCloseMedia}
+ onChangeBackgroundColor={this.setBackgroundColor}
/>
)}
</ModalRoot>