-
Notifications
You must be signed in to change notification settings - Fork 81
Do not store activitypub_max_image_attachments
if it uses the default value
#1821
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
Conversation
activitypub_max_image_attachments
if it is the defaultactivitypub_max_image_attachments
if it uses the default value
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 prevents storing the activitypub_max_image_attachments
post meta when it matches the default setting, reducing unnecessary database entries.
Key changes:
- Updated
updated_postmeta
to delete meta when it equals the default option - Added unit tests for this behavior
- Created a changelog entry for the change
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
tests/includes/class-test-activitypub.php | Adds test_updated_postmeta to verify default-value meta is not persisted and custom values are |
includes/class-activitypub.php | Extends updated_postmeta to delete the max-image-attachments meta if it equals the default |
.github/changelog/1821-from-description | Adds a patch-level changelog entry detailing the behavior change |
Comments suppressed due to low confidence (1)
includes/class-activitypub.php:692
- [nitpick] Update the docblock above
updated_postmeta
to mention that this method also removes theactivitypub_max_image_attachments
meta when it matches the default.
public static function updated_postmeta( $meta_id, $object_id, $meta_key, $meta_value ) {
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
This should be good to go as-is.
The function doc is currently specific to activitypub_content_visibility
, so that could be generalized, but I'm not sure I'd consider it a blocker.
Potential follow-ups:
- We could consider giving
activitypub_content_warning
a similar treatment. - I don't know if it's possible to move this to the
update_post_metadata
hook and avoid the step of updating the value? - Should all of this also happen when a meta value gets added?
I will work on a follow up! I think it should work for both! |
this is a follow up of #1821
Do not store the
activitypub_max_image_attachments
Post-Meta, if it is the same as the default, to not spam the DB.Proposed changes:
activitypub_max_image_attachments
setting from the block editor has the same value as the default, and remove it if so.Other information:
Testing instructions:
Changelog entry
Changelog Entry Details
Significance
Type
Message
The image attachment setting is no longer saved to the database if it matches the default value.