Skip to content

Remove share attributes & use OCShare extensions #1758

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

Merged
merged 7 commits into from
Jul 17, 2025

Conversation

alperozturk96
Copy link
Contributor

@alperozturk96 alperozturk96 commented Jun 30, 2025

Client PR: nextcloud/android#15074

Issue

Since Nextcloud 30, the enabled key have been renamed to value and supports more than boolean.

Introducing a generic data class to handle both variations of the JSONArray adds unnecessary complexity when creating or updating the download attribute of a share. Instead, we can simplify the implementation by directly constructing a JsonArray with JsonObject elements, while still providing the same functionality.

Copy link
Contributor

SpotBugs

CategoryBaseNew
Bad practice3434
Correctness3434
Dodgy code2626
Internationalization66
Malicious code vulnerability4949
Multithreaded correctness1111
Performance88
Total168168

Copy link
Contributor

SpotBugs

CategoryBaseNew
Bad practice3434
Correctness3434
Dodgy code2626
Internationalization66
Malicious code vulnerability4949
Multithreaded correctness1111
Performance88
Total168168

Copy link

codecov bot commented Jun 30, 2025

Codecov Report

Attention: Patch coverage is 0% with 27 lines in your changes missing coverage. Please review.

Project coverage is 42.85%. Comparing base (ccc7ae5) to head (0303be5).
Report is 8 commits behind head on master.

Files with missing lines Patch % Lines
...b/resources/shares/extensions/OCShareExtensions.kt 0.00% 27 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1758      +/-   ##
============================================
- Coverage     43.06%   42.85%   -0.22%     
+ Complexity      987      981       -6     
============================================
  Files           235      233       -2     
  Lines          8569     8574       +5     
  Branches       1123     1127       +4     
============================================
- Hits           3690     3674      -16     
- Misses         4361     4390      +29     
+ Partials        518      510       -8     
Files with missing lines Coverage Δ
...b/resources/shares/extensions/OCShareExtensions.kt 0.00% <0.00%> (ø)

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@alperozturk96 alperozturk96 changed the title Remove share attributes Remove share attributes & use OCShare extensions Jul 1, 2025
Copy link
Contributor

github-actions bot commented Jul 1, 2025

SpotBugs

CategoryBaseNew
Bad practice3434
Correctness3434
Dodgy code2626
Internationalization66
Malicious code vulnerability4949
Multithreaded correctness1111
Performance88
Total168168

Copy link
Contributor

github-actions bot commented Jul 1, 2025

SpotBugs

CategoryBaseNew
Bad practice3434
Correctness3434
Dodgy code2626
Internationalization66
Malicious code vulnerability4949
Multithreaded correctness1111
Performance88
Total168168

private const val VALUE_KEY = "value"
private const val ENABLED_KEY = "enabled"

fun toggleAllowDownloadAndSync(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This cannot be implemented as an extension, as the share object does not exist at the time of share creation. Therefore, optional attributes should be passed as a string parameter instead.

Copy link
Contributor

github-actions bot commented Jul 1, 2025

SpotBugs

CategoryBaseNew
Bad practice3434
Correctness3434
Dodgy code2626
Internationalization66
Malicious code vulnerability4949
Multithreaded correctness1111
Performance88
Total168168

Copy link
Contributor

github-actions bot commented Jul 4, 2025

SpotBugs

CategoryBaseNew
Bad practice3434
Correctness3434
Dodgy code2626
Internationalization66
Malicious code vulnerability4949
Multithreaded correctness1111
Performance88
Total168168

Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
@alperozturk96 alperozturk96 force-pushed the remove-share-attributes branch from 3dbcf59 to 0303be5 Compare July 14, 2025 10:39
Copy link
Contributor

SpotBugs

CategoryBaseNew
Bad practice3434
Correctness3434
Dodgy code2626
Internationalization66
Malicious code vulnerability4949
Multithreaded correctness1111
Performance88
Total168168

Copy link
Member

@AndyScherzinger AndyScherzinger left a comment

Choose a reason for hiding this comment

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

LGTM

@alperozturk96 alperozturk96 merged commit 89ddcfc into master Jul 17, 2025
17 of 19 checks passed
@alperozturk96 alperozturk96 deleted the remove-share-attributes branch July 17, 2025 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants