Skip to content

Restore and backup image sizes alongside the sources properties #242

New issue

Have a question about this project? Sign up for a free account to open an issue and contact its maintainers and the community.

By clicking “Sign up for ”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on ? Sign in to your account

Merged
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
a6f5e07
Add class to mimic image operations on the editor.
mitoghMar 19, 2022
4820501
Restore and backup image sizes including `sources`.
mitoghMar 19, 2022
ab7bf05
Merge branch 'trunk' into feature/228-restore-and-backup-image-sources
mitoghMar 22, 2022
7e82041
Remove handling of edited images
mitoghMar 23, 2022
a2b82e3
Update the `success` logic to handle additional cases.
mitoghMar 23, 2022
ba0cbdf
Update logic to store and restore backup.
mitoghMar 23, 2022
2dd29d8
Remove empty space
mitoghMar 23, 2022
b16cee1
Update prefix on functions
mitoghMar 23, 2022
8a8e967
Update prefix on functions
mitoghMar 23, 2022
322dd3d
Update prefix on functions
mitoghMar 23, 2022
226a5aa
Update hooks reference
mitoghMar 23, 2022
8a809ed
Backup the data from previous metadata
mitoghMar 23, 2022
6d134e5
Merge branch 'trunk' into feature/228-restore-and-backup-image-sources
mitoghMar 24, 2022
76307e6
Merge branch 'trunk' into feature/228-restore-and-backup-image-sources
mitoghMar 24, 2022
951c4ca
Remove the need of auxilary variable to hold the sources
mitoghMar 26, 2022
61e25e8
Add `since` doc block
mitoghMar 28, 2022
4c26f4f
Align parameters on the doc block
mitoghMar 28, 2022
973a7b8
Removal of non required parameter
mitoghMar 28, 2022
cb35f42
Align parameters to follow WordPress guidelines
mitoghMar 28, 2022
7880f6b
Include the `@since` tags on missing functions
mitoghMar 28, 2022
ca8d28e
Move logic of the hook into a variable
mitoghMar 28, 2022
c381398
Add white spaces on tests
mitoghMar 30, 2022
93e0d01
Add white spaces on tests
mitoghMar 30, 2022
c165a11
Removal of `sanitize_text_field` due this value is not required.
mitoghMar 30, 2022
7d96583
Run logic only if was executed when doing ajax.
mitoghMar 30, 2022
7a113d3
Update code flow for more performant checks
mitoghMar 30, 2022
e202548
Split conditionals into separate statements
mitoghMar 30, 2022
188c7df
Removal of non requried conditional
mitoghMar 30, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
Next Next commit
Update the success logic to handle additional cases.
When an image is edited using a target other than the
all and the thumbnail make sure the `success` method
returns the correct value.
  • Loading branch information
@mitogh
mitogh committedMar 23, 2022
commit a2b82e373bba288029aa9ab3c701cac2148e6085
Original file line numberDiff line numberDiff line change
Expand Up@@ -162,6 +162,16 @@ public function save() {
* @return bool whether the operation to save the image was succesfully or not.
*/
public function success() {
return is_object( $this->result ) && property_exists( $this->result, 'msg' ) && property_exists( $this->result, 'thumbnail' ) && 'Image saved' === $this->result->msg;
if ( ! is_object( $this->result ) ) {
return false;
}

$valid_target = true;
// The thumbnail property is only set in `all` and `thumbnail` target.
if ( 'all' === $this->target || 'thumbnail' === $this->target ) {
$valid_target = property_exists( $this->result, 'thumbnail' );
}

return property_exists( $this->result, 'msg' ) && $valid_target && 'Image saved' === $this->result->msg;
}
}