Skip to content

Commit

Permalink
Update media always makes content IN_PROGRESS #9663
Browse files Browse the repository at this point in the history
(cherry picked from commit ed35a8d)
  • Loading branch information
rymsha committed Aug 31, 2022
1 parent d9bda72 commit 41e41e7
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import com.enonic.xp.content.Content;
import com.enonic.xp.content.UpdateContentParams;
import com.enonic.xp.content.UpdateMediaParams;
import com.enonic.xp.content.WorkflowInfo;
import com.enonic.xp.content.WorkflowState;
import com.enonic.xp.core.impl.content.serializer.ContentDataSerializer;
import com.enonic.xp.media.MediaInfo;
import com.enonic.xp.media.MediaInfoService;
Expand Down Expand Up @@ -104,12 +102,6 @@ private Content doExecute()
.createAttachments( CreateAttachments.from( mediaAttachment ) )
.editor( editable -> {
mediaFormBuilder.build( editable.data );

if ( WorkflowState.READY == editable.workflowInfo.getState() )
{
editable.workflowInfo =
WorkflowInfo.create().checks( editable.workflowInfo.getChecks() ).state( WorkflowState.IN_PROGRESS ).build();
}
} );

return UpdateContentCommand.create( this )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ public void update_media_image()

final Content updatedContent = this.contentService.getById( storedContent.getId() );

assertEquals( WorkflowState.IN_PROGRESS, updatedContent.getWorkflowInfo().getState() );

final Attachments attachments = updatedContent.getAttachments();

assertNotNull( attachments );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import com.enonic.xp.content.SetContentChildOrderParams;
import com.enonic.xp.content.UpdateContentParams;
import com.enonic.xp.content.UpdateMediaParams;
import com.enonic.xp.content.WorkflowInfo;
import com.enonic.xp.core.impl.content.ContentEventsSyncParams;
import com.enonic.xp.core.impl.content.ContentSyncEventType;
import com.enonic.xp.core.impl.content.ContentSyncParams;
Expand Down Expand Up @@ -343,14 +342,7 @@ public void updateMediaChanged()
}
} );

Content targetContentUpdated = syncUpdated( sourceContent.getId() );

assertEquals( targetContent, targetContentUpdated );

sourceContext.runWith( () -> contentService.update(
new UpdateContentParams().contentId( sourceContent.getId() ).editor( edit -> edit.workflowInfo = WorkflowInfo.ready() ) ) );

targetContentUpdated = syncUpdated( sourceContent.getId() );
final Content targetContentUpdated = syncUpdated( sourceContent.getId() );

assertNotEquals( targetContent.getAttachments().first().getBinaryReference(),
targetContentUpdated.getAttachments().first().getBinaryReference() );
Expand Down

0 comments on commit 41e41e7

Please sign in to comment.