prepopulate thumbnail on edit

This commit is contained in:
Sean Yesmunt 2018-06-13 00:19:39 -04:00
parent ae93a0d95d
commit 6f666e757f
2 changed files with 9 additions and 2 deletions

View file

@ -50,6 +50,7 @@ type Props = {
publishing: boolean,
balance: number,
isStillEditing: boolean,
thumbnailUploadStatus: string,
clearPublish: () => void,
resolveUri: string => void,
scrollToTop: () => void,
@ -73,7 +74,10 @@ class PublishForm extends React.PureComponent<Props> {
}
componentWillMount() {
this.props.resetThumbnailStatus();
const { isStillEditing, thumbnail } = this.props;
if (!isStillEditing || !thumbnail) {
this.props.resetThumbnailStatus();
}
}
getNewUri(name: string, channel: string) {

View file

@ -22,8 +22,10 @@ type PromiseAction = Promise<Action>;
type Dispatch = (action: Action | PromiseAction | Array<Action>) => any;
type GetState = () => {};
export const doClearPublish = () => (dispatch: Dispatch): Action =>
export const doClearPublish = () => (dispatch: Dispatch): PromiseAction => {
dispatch({ type: ACTIONS.CLEAR_PUBLISH });
return dispatch(doResetThumbnailStatus());
};
export const doUpdatePublishForm = (publishFormValue: UpdatePublishFormData) => (
dispatch: Dispatch
@ -160,6 +162,7 @@ export const doPrepareEdit = (claim: any, uri: string) => (dispatch: Dispatch) =
thumbnail,
title,
uri,
uploadThumbnailStatus: thumbnail ? STATUSES.MANUAL : undefined,
};
dispatch({ type: ACTIONS.DO_PREPARE_EDIT, data: publishData });