Pending edit magic #1654

Merged
tzarebczan merged 1 commit from pending-edit into master 2018-06-20 21:31:42 +02:00
4 changed files with 6 additions and 9 deletions

View file

@ -43,9 +43,9 @@ class FileCard extends React.PureComponent<Props> {
}
resolve = (props: Props) => {
const { isResolvingUri, resolveUri, claim, uri } = props;
const { isResolvingUri, resolveUri, claim, uri, pending } = props;
if (!isResolvingUri && claim === undefined && uri) {
if (!pending && !isResolvingUri && claim === undefined && uri) {
resolveUri(uri);
}
};

View file

@ -231,7 +231,7 @@ export const doPublish = (params: PublishParams) => (dispatch: Dispatch, getStat
const success = () => {
dispatch({
type: ACTIONS.PUBLISH_SUCCESS,
data: { pendingPublish: { ...publishPayload, isEdit: isStillEditing } },
data: { pendingPublish: { ...publishPayload } },
});
dispatch(doNotify({ id: MODALS.PUBLISH }, { uri }));
};

View file

@ -147,12 +147,9 @@ export default handleActions(
[ACTIONS.PUBLISH_SUCCESS]: (state: PublishState, action): PublishState => {
const { pendingPublish } = action.data;
// If it's an edit, don't create a pending publish
// It will take some more work to know when an edit is confirmed
const newPendingPublishes = state.pendingPublishes.slice();
if (!pendingPublish.isEdit) {
newPendingPublishes.push(pendingPublish);
}
newPendingPublishes.push(pendingPublish);
return {
...state,

View file

@ -40,7 +40,7 @@ export const selectPendingPublish = uri =>
}
return pendingPublishes.filter(
publish => (publish.name === claimName || publish.name === contentName) && !publish.isEdit
publish => publish.name === claimName || publish.name === contentName
)[0];
});