Skip to content

✨ Mobile + Admin | Allow disabling post comments#1547

Merged
zacharykeeping merged 3 commits intomainfrom
disable-comments
Feb 18, 2026
Merged

✨ Mobile + Admin | Allow disabling post comments#1547
zacharykeeping merged 3 commits intomainfrom
disable-comments

Conversation

@zacharykeeping
Copy link
Member

  1. What triggered this change? (PBI link, Email Subject, conversation + reason, etc)

Closes #1546

  1. What was changed?
  1. Adds the option to disable comments on posts when creating or updating.
  2. Updates post page in app to not show and not allow comments when disabled.
  3. Bumps .NET SDK version and updates .gitignore to workaround a build issue introduced in a recent version of MSBuild (see MSB3552: Resource file "**/*.resx" cannot be found when there is a long path dotnet/msbuild#12546 (comment))
  1. Did you do pair or mob programming?

No

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 CommentsDisabled on Post with EF Core migration + configuration.
  • Plumbs CommentsDisabled through 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 CLR List<> inside the EF projection. This can cause runtime could not be translated exceptions. Consider keeping the projection purely queryable (e.g., filter the comments subquery based on p.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" 

Copy link
Member

@jernejk jernejk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zacharykeeping zacharykeeping merged commit fe85529 into main Feb 18, 2026
6 checks passed
@zacharykeeping zacharykeeping deleted the disable-comments branch February 18, 2026 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

♻️ Mobile + Admin | Disable comments on posts

3 participants