Add Item user info property reporting whether it is shareable or not#83
Merged
Conversation
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new item user info property ("displayShare") to indicate if an item is shareable based on its permissions. Key changes include:
- A new test in ItemPropertyTests.swift to confirm that displayShare is not set when an item is not shareable.
- Updated logic in Item.swift to add the displayShare flag when the metadata permissions include "R" and the item is not a container.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| Tests/NextcloudFileProviderKitTests/ItemPropertyTests/ItemPropertyTests.swift | Introduces testItemUserInfoDisplayShare to validate non-shareable items do not get a displayShare property |
| Sources/NextcloudFileProviderKit/Item/Item.swift | Updates userInfo property to conditionally add displayShare when the item is shareable |
Comments suppressed due to low confidence (2)
Sources/NextcloudFileProviderKit/Item/Item.swift:208
- [nitpick] Consider whether the key name 'displayShare' clearly expresses its purpose compared to other display keys; a more descriptive name may improve consistency and clarity across the codebase.
if metadata.permissions.uppercased().contains("R"), // Shareable
Tests/NextcloudFileProviderKitTests/ItemPropertyTests/ItemPropertyTests.swift:338
- [nitpick] Consider adding a complementary test case that verifies displayShare is set to true when metadata.permissions includes 'R', ensuring that both negative and positive scenarios are covered.
XCTAssertNil(item.userInfo?["displayShare"])
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #83 +/- ##
==========================================
+ Coverage 82.53% 82.58% +0.04%
==========================================
Files 71 71
Lines 14603 14630 +27
==========================================
+ Hits 12053 12082 +29
+ Misses 2550 2548 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
No description provided.