Add 'Remove all tags' ption for files and folders#18262
Open
shivansh31414 wants to merge 1 commit intofiles-community:mainfrom
Open
Add 'Remove all tags' ption for files and folders#18262shivansh31414 wants to merge 1 commit intofiles-community:mainfrom
shivansh31414 wants to merge 1 commit intofiles-community:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a "Remove all tags" context menu option for files and folders, allowing users to clear all tag metadata in a single action. This is backed by a new FileTagsContextMenuViewModel that encapsulates tag manipulation logic, extracted from the UI layer.
Changes:
- New
FileTagsContextMenuViewModelwithRemoveAllTags,UpdateTagSelection, andIsTagAppliedToAllSelectedItemsmethods - Refactored
FileTagsContextMenuto use the new ViewModel and added a "Remove all tags" menu item - Added comprehensive unit tests and the localized string resource
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/Files.App/ViewModels/UserControls/Menus/FileTagsContextMenuViewModel.cs |
New ViewModel encapsulating tag add/remove/clear logic |
src/Files.App/UserControls/Menus/FileTagsContextMenu.cs |
Refactored to use ViewModel; added "Remove all tags" menu item |
src/Files.App/Strings/en-US/Resources.resw |
Added RemoveAllTags localized string |
tests/Files.InteractionTests/Files.InteractionTests.csproj |
Added project reference and DI package for tests |
tests/Files.InteractionTests/Tests/FileTagsContextMenuViewModelTests.cs |
Unit tests for the new ViewModel |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+79
to
+84
| removeAllTagsMenuItem.IsEnabled = viewModel.CanRemoveAllTags; | ||
| } | ||
|
|
||
| private void RemoveFileTag(IEnumerable<ListedItem> selectedListedItems, TagViewModel removed) | ||
| private void Item_Opening(object? sender, object e) | ||
| { | ||
| foreach (var selectedItem in selectedListedItems) | ||
| { | ||
| var existingTags = selectedItem.FileTags ?? []; | ||
| if (existingTags.Contains(removed.Uid)) | ||
| { | ||
| var tagList = existingTags.Except(new[] { removed.Uid }).ToArray(); | ||
| selectedItem.FileTags = tagList; | ||
| } | ||
| } | ||
| TagsChanged?.Invoke(this, EventArgs.Empty); | ||
| removeAllTagsMenuItem.IsEnabled = viewModel.CanRemoveAllTags; |
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.
Resolved / Related Issues
Closes Feature: Add “Remove all tags” option for files and folders
Steps used to test these changes
Applied multiple tags to files and folders.
Used the new “Remove all tags” option from the context menu.
Verified all tags were cleared in one action.
Confirmed UI updated correctly in the Status Center.
Tested with items that had no tags to ensure graceful handling.
Checked multiple selections to confirm consistent behavior.
Ran accessibility checks with Accessibility Insights for Windows.
Validated no regressions or memory leaks occurred.