diff --git a/app/assets/javascripts/components/features/compose/components/upload_button.jsx b/app/assets/javascripts/components/features/compose/components/upload_button.jsx
index f00ef3f8fa..4c8181aa13 100644
--- a/app/assets/javascripts/components/features/compose/components/upload_button.jsx
+++ b/app/assets/javascripts/components/features/compose/components/upload_button.jsx
@@ -12,7 +12,8 @@ const UploadButton = React.createClass({
disabled: React.PropTypes.bool,
onSelectFile: React.PropTypes.func.isRequired,
style: React.PropTypes.object,
- key: React.PropTypes.number
+ resetFileKey: React.PropTypes.number,
+ intl: React.PropTypes.object.isRequired
},
mixins: [PureRenderMixin],
@@ -32,12 +33,12 @@ const UploadButton = React.createClass({
},
render () {
- const { intl } = this.props;
+ const { intl, resetFileKey, disabled } = this.props;
return (
-
-
+
+
);
}
diff --git a/app/assets/javascripts/components/features/compose/containers/upload_button_container.jsx b/app/assets/javascripts/components/features/compose/containers/upload_button_container.jsx
index 7afa7d355b..78e5312f57 100644
--- a/app/assets/javascripts/components/features/compose/containers/upload_button_container.jsx
+++ b/app/assets/javascripts/components/features/compose/containers/upload_button_container.jsx
@@ -4,7 +4,7 @@ import { uploadCompose } from '../../../actions/compose';
const mapStateToProps = state => ({
disabled: state.getIn(['compose', 'is_uploading']) || (state.getIn(['compose', 'media_attachments']).size > 3 || state.getIn(['compose', 'media_attachments']).some(m => m.get('type') === 'video')),
- key: Math.floor((Math.random() * 0x10000))
+ resetFileKey: state.getIn(['compose', 'resetFileKey'])
});
const mapDispatchToProps = dispatch => ({
diff --git a/app/assets/javascripts/components/reducers/compose.jsx b/app/assets/javascripts/components/reducers/compose.jsx
index baa7d7f5a7..5f309452b9 100644
--- a/app/assets/javascripts/components/reducers/compose.jsx
+++ b/app/assets/javascripts/components/reducers/compose.jsx
@@ -38,7 +38,8 @@ const initialState = Immutable.Map({
media_attachments: Immutable.List(),
suggestion_token: null,
suggestions: Immutable.List(),
- me: null
+ me: null,
+ resetFileKey: Math.floor((Math.random() * 0x10000))
});
function statusToTextMentions(state, status) {
@@ -65,6 +66,7 @@ function appendMedia(state, media) {
return state.withMutations(map => {
map.update('media_attachments', list => list.push(media));
map.set('is_uploading', false);
+ map.set('resetFileKey', Math.floor((Math.random() * 0x10000)));
map.update('text', oldText => `${oldText} ${media.get('text_url')}`.trim());
});
};