-
-
Notifications
You must be signed in to change notification settings - Fork 773
Fix new pages remain in Draft when Versioning is enabled and Workflow is disabled #6836
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes an issue where new pages remained in Draft status when Versioning was enabled but Workflow was disabled. The fix ensures pages are created with the correct published state for all combinations of Versioning and Workflow settings, particularly addressing the broken case where Versioning=On and Workflow=Off.
Key changes:
- Adds logic to hide workflow menu items (Complete/Discard) when Direct Publish workflow is active, reducing UI confusion
- Refactors workflow information display in PersonaBar to show more accurate state information even when no explicit state is assigned
- Fixes portal ID retrieval in WorkflowHelper to use the tab's portal ID instead of current portal settings
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| Dnn.AdminExperience/EditBar/Dnn.EditBar.UI/Items/WorkflowBaseMenuItem.cs | Adds IsDirectPublishWorkflow property to identify when Direct Publish workflow is active |
| Dnn.AdminExperience/EditBar/Dnn.EditBar.UI/Items/DiscardWorkflowMenu.cs | Updates visibility logic to hide discard menu when Direct Publish workflow is active |
| Dnn.AdminExperience/EditBar/Dnn.EditBar.UI/Items/CompleteWorkflowMenu.cs | Updates visibility logic to hide complete menu when Direct Publish workflow is active |
| Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Pages/WorkflowHelper.cs | Fixes potential null reference by using tab's PortalID instead of PortalSettings.Current |
| Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Pages/PagesControllerImpl.cs | Refactors workflow handling to determine StateName and WorkflowName with proper null handling when StateID is not set |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ? workflow.LastState.StateName | ||
| : workflow.FirstState.StateName; |
Copilot
AI
Dec 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential NullReferenceException: workflow.LastState and workflow.FirstState can return null if the workflow has no states. Use the null-conditional operator to safely access StateName:
: isWorkflowCompleted
? workflow.LastState?.StateName
: workflow.FirstState?.StateName;| ? workflow.LastState.StateName | |
| : workflow.FirstState.StateName; | |
| ? workflow.LastState?.StateName | |
| : workflow.FirstState?.StateName; |
| public override bool Visible() => base.Visible() | ||
| && !this.IsDirectPublishWorkflow | ||
| && ((this.IsLastState == false && (this.IsDraftWithPermissions == true || this.IsReviewOrOtherIntermediateStateWithPermissions == true)) | ||
| || (this.IsLastState == true && this.HasUnpublishVersion && this.HasDraftPermission)); // for Direct Publish workflow |
Copilot
AI
Dec 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment "for Direct Publish workflow" is now misleading since line 37 explicitly excludes the Direct Publish workflow from being visible. This comment should either be removed or updated to clarify that this condition handles other workflow scenarios.
| || (this.IsLastState == true && this.HasUnpublishVersion && this.HasDraftPermission)); // for Direct Publish workflow | |
| || (this.IsLastState == true && this.HasUnpublishVersion && this.HasDraftPermission)); // handles other workflow scenarios (not Direct Publish) |
| && !this.IsDirectPublishWorkflow | ||
| && (this.IsReviewOrOtherIntermediateStateWithPermissions == true | ||
| || (this.IsPriorState == true && this.IsDraftWithPermissions == true) // for Save Draft workflow | ||
| || (this.IsLastState == true && this.HasUnpublishVersion && this.HasDraftPermission == true)); // for Direct Publish workflow |
Copilot
AI
Dec 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment "for Direct Publish workflow" is now misleading since line 37 explicitly excludes the Direct Publish workflow from being visible. This comment should either be removed or updated to clarify that this condition handles other workflow scenarios.
| || (this.IsLastState == true && this.HasUnpublishVersion && this.HasDraftPermission == true)); // for Direct Publish workflow | |
| || (this.IsLastState == true && this.HasUnpublishVersion && this.HasDraftPermission == true)); // handles other workflow scenarios (not Direct Publish) |
Fixes #6810
Summary
New pages behave correctly for all combinations of Versioning and Workflow settings:
TODO
Specifically, auto-publish pages that were incorrectly created as Draft when: