✨ Mobile + Admin | Allow disabling post comments#1547
Merged
zacharykeeping merged 3 commits intomainfrom Feb 18, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a per-post “comments disabled” flag across the API, AdminUI, and Mobile UI so admins can disable comments and the app hides/blocks commenting accordingly (plus a .NET SDK bump/build workaround updates).
Changes:
- Introduces
CommentsDisabledonPostwith EF Core migration + configuration. - Plumbs
CommentsDisabledthrough create/update DTOs + commands/handlers and post queries. - Updates Mobile UI and AdminUI to hide/disable comments UI when comments are disabled; bumps .NET SDK to 10.0.103 and updates build-related files.
Reviewed changes
Copilot reviewed 22 out of 24 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/WebAPI/Dockerfile | Bump SDK image to 10.0.103 for API container build. |
| src/WebAPI/Controllers/PostsController.cs | Maps CommentsDisabled from DTOs into create/update commands. |
| src/MobileUI/Features/Posts/PostListPage.xaml | Hides comment icon/count when CommentsDisabled is true. |
| src/MobileUI/Features/Posts/PostDetailPage.xaml | Hides comments section + add-comment UI and shows a “disabled” notice. |
| src/Infrastructure/Persistence/Migrations/ApplicationDbContextModelSnapshot.cs | Updates EF snapshot for new CommentsDisabled column. |
| src/Infrastructure/Persistence/Migrations/20260211005343_AddCommentsDisabledToPost.cs | Adds CommentsDisabled column to Posts with default false. |
| src/Infrastructure/Persistence/Migrations/20260211005343_AddCommentsDisabledToPost.Designer.cs | EF migration designer reflecting the updated model. |
| src/Infrastructure/Persistence/Configurations/PostConfiguration.cs | Configures default value for CommentsDisabled. |
| src/Domain/Entities/Post.cs | Adds CommentsDisabled property to the Post domain entity. |
| src/Common/DTOs/Posts/UpdatePostDto.cs | Adds CommentsDisabled to update DTO. |
| src/Common/DTOs/Posts/PostDto.cs | Adds CommentsDisabled to post list DTO. |
| src/Common/DTOs/Posts/CreatePostDto.cs | Adds CommentsDisabled to create DTO. |
| src/Application/Posts/Queries/GetPosts/GetPostsQuery.cs | Projects CommentsDisabled into PostDto. |
| src/Application/Posts/Queries/GetPostById/GetPostByIdQuery.cs | Projects CommentsDisabled and attempts to hide comments when disabled. |
| src/Application/Posts/Commands/UpdatePost/UpdatePostCommand.cs | Adds CommentsDisabled to command and updates entity on update. |
| src/Application/Posts/Commands/CreatePost/CreatePostCommand.cs | Adds CommentsDisabled to command and sets it on create. |
| src/Application/Posts/Commands/AddPostComment/AddPostCommentCommand.cs | Blocks adding comments when comments are disabled. |
| src/AdminUI/Pages/Posts.razor | Shows an “Off” chip when comments are disabled. |
| src/AdminUI/Dockerfile | Bump SDK image to 10.0.103 for AdminUI container build/dev. |
| src/AdminUI/Components/CreatePostDialog.razor | Adds checkbox to disable comments on create/edit and plumbs into DTOs. |
| global.json | Bumps repo SDK/workload version to 10.0.103. |
| WARP.md | Updates documented SDK version to 10.0.103. |
| .gitignore | Adds ignore patterns for literal bin\Debug folder issue on macOS/Linux. |
| .github/chatmodes/gh-actions.chatmode.md | Updates documented .NET SDK version to 10.0.103. |
Files not reviewed (1)
- src/Infrastructure/Persistence/Migrations/20260211005343_AddCommentsDisabledToPost.Designer.cs: Language not supported
Comments suppressed due to low confidence (3)
src/Application/Posts/Queries/GetPostById/GetPostByIdQuery.cs:61
- The conditional projection for
Comments(p.CommentsDisabled ? new List<PostCommentDto>() : p.PostComments...ToList()) is unlikely to translate to SQL because it constructs a new CLRList<>inside the EF projection. This can cause runtimecould not be translatedexceptions. Consider keeping the projection purely queryable (e.g., filter the comments subquery based onp.CommentsDisabled) or materialize the post first and then conditionally load comments in a separate query.
Comments = p.CommentsDisabled
? new List<PostCommentDto>()
: p.PostComments
.Select(c => new PostCommentDto
{
Id = c.Id,
PostId = c.PostId,
UserId = c.UserId,
UserName = c.User.FullName ?? "",
UserAvatar = c.User.Avatar ?? "",
Comment = c.Comment,
CreatedUtc = c.CreatedUtc,
CanDelete = isAdmin || c.UserId == currentUserId
})
.OrderByDescending(c => c.CreatedUtc)
.ToList()
src/AdminUI/Pages/Posts.razor:95
- Empty block without comment.
{
<MudChip Icon="@Icons.Material.Filled.CommentsDisabled" Size="Size.Small" Color="Color.Warning">Off</MudChip>
}
</MudTd>
<MudTd DataLabel="Actions">
<MudIconButton Icon="@Icons.Material.Filled.Edit"
Size="Size.Small"
OnClick="@(() => OpenEditDialog(context))" />
<MudIconButton Icon="@Icons.Material.Filled.Delete"
src/AdminUI/Pages/Posts.razor:95
- If-statement with an empty then-branch and no else-branch.
@if (context.CommentsDisabled)
{
<MudChip Icon="@Icons.Material.Filled.CommentsDisabled" Size="Size.Small" Color="Color.Warning">Off</MudChip>
}
</MudTd>
<MudTd DataLabel="Actions">
<MudIconButton Icon="@Icons.Material.Filled.Edit"
Size="Size.Small"
OnClick="@(() => OpenEditDialog(context))" />
<MudIconButton Icon="@Icons.Material.Filled.Delete"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1546
No