-
Notifications
You must be signed in to change notification settings - Fork 137
Remove unused MediaModel properties
#15130
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
base: trunk
Are you sure you want to change the base?
Conversation
Generated by 🚫 Danger |
📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
|
|
📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## trunk #15130 +/- ##
============================================
+ Coverage 38.64% 38.65% +0.01%
+ Complexity 10456 10455 -1
============================================
Files 2181 2181
Lines 123905 123860 -45
Branches 17100 17094 -6
============================================
- Hits 47877 47876 -1
+ Misses 71205 71160 -45
- Partials 4823 4824 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
753d1e2 to
adfa1e6
Compare
| * | ||
| * @return filename with extension, or null if no extension could be determined | ||
| */ | ||
| private fun ensureFilenameHasExtension(filename: String, mimeType: String): String? { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I refactored this to a method for improved readability as fileExtension was no longer used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR removes unused properties and methods from the MediaModel class and related code to clean up technical debt. The changes include removing video-specific properties (VideoPress GUID, dimensions, length), legacy properties (horizontal/vertical alignment, featured flags), and alternative image size URLs that were no longer being used.
Key changes:
- Removed 20+ unused fields and their getters/setters from
MediaModel - Updated constructors across the codebase to match the simplified
MediaModelsignature - Removed
getUrlForSiteVideoWithVideoPressGuid()method fromMediaStore - Updated tests to reflect the simplified model
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| MediaModel.java | Removed unused properties (authorId, guid, fileExtension, width, height, length, videoPressGuid, fileUrl*Size fields, and legacy alignment/featured properties) and their accessors; simplified constructors and equals() method |
| MediaStore.java | Removed unused getUrlForSiteVideoWithVideoPressGuid() method |
| MediaXMLRPCClient.java | Updated getMediaFromXmlrpcResponse() to use simplified MediaModel constructor without removed parameters |
| MediaWPComRestResponse.java | Removed unused fields from response model (author_ID, guid, extension, width, height, length, videopress fields, and thumbnail size URLs) |
| MediaRestClient.java | Updated to pass localSiteId to getMediaFromRestResponse() and removed unused response parsing call |
| MediaResponseUtils.kt | Updated getMediaFromRestResponse() to accept localSiteId parameter and use simplified MediaModel constructor |
| MediaWPRESTResponse.kt | Removed unused fields from response model and updated toMediaModel() extension function to use simplified constructor |
| FileUploadUtils.kt | Refactored filename extension handling into separate method and updated MediaModel constructor call |
| MediaTestUtils.java | Updated test utility to calculate extension locally instead of storing it in MediaModel |
| MediaStoreTest.java | Removed test for getUrlForSiteVideoWithVideoPressGuid() as the method was deleted |
| MediaSqlUtilsTest.java | Updated test to use simplified MediaModel constructor without removed fields |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Related: AINFRA-542: Migrate
MediaModelDescription
This PR removes unused code related to
MediaModel.Test Steps
Smoke test browsing and uploading images to products. Please test both WPCOM and self-hosted connections. And actually maybe something else that you know should be tested when working with media.
RELEASE-NOTES.txtif necessary. Use the "[Internal]" label for non-user-facing changes.