-
Notifications
You must be signed in to change notification settings - Fork 44
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
80 wp user avatar #85
Conversation
@jeffpaul I had to get this over to you to at least start a conversation or else it would drag on too much. I know there is a lot of code duplication between the ajax version and the cli version. The CLI warning, error, and success messages sprinkled throughout the method made it a bit more difficult to re-use for the ajax version. I'm happy to DRY it out but wanted to at least get your eyes on it before wasting much more time. Happy to make any and all revisions you see fit. |
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.
Overall looks reasonable code-wise, I did not functionally test it for the moment. Left inline notes about smaller things, as for the DRY part I do think it's worth doing for consistency and sanity. You should be able to split the code paths within one method with the WP_CLI
constant, and the AJAX version really should return a response status and message to show user feedback on the screen, e.g. "successfully migrated X avatars" or a descriptive error message.
@helen Thanks for the feedback. I refactored the migration method to return an integer based on how many avatars were processed. That method is called in the ajax or the wp-cli methods then the value is used in the messaging. I still have some work to do with javascript error messaging and spinner for the dashboard version. |
@helen I added localized success and error messages to the admin version so the user can see how many avatars were processed. I am very close to finishing my work depending on your feedback. This could use another code review when you have a minute. |
@faisal-alvi Please unapprove this PR. I have not fixed the major issue of it not working on single-site installs. |
@faisal-alvi This is ready for review. I added support for single-site installs. Testing Steps
Repeat steps for single site install and multisite install. |
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.
LGTM! Just a question asked, good to be merged.
@faisal-alvi I am not sure what the release process is for this plugin BUT all of the JS from this PR lives in the |
@claytoncollie I have re-checked the functionality. When trying to follow these steps, on step no 2, I can not select any image for the avatar. It works for the sla-avtar-issue-pr85.mp4 |
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.
Re-requesting changes to fix the avatar selection issue.
@claytoncollie regarding your JS question, we use |
@faisal-alvi I reverted how we are grabbing the
As for the minified JS, I do not feel comfortable adding that to this PR. There is no package.json file in this plugin. Can you all take care of minification in the release branch in case there are other changes from other PRs? |
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.
Thanks for the changes @claytoncollie.
- Let's leave the
(int) $_GET('user_id')
which is not related to the current PR. - I have added
package.json
and also addeduglifyjs
(in Introducing Package file #94) so we just have to runnpm run uglifyjs
and it will minify the dev JS file and update the content of thesimple-local-avatars.js
file (which is a minfied version of the dev file).
Leaving this PR until #94 is merged, then you can run the command and we are good to merge.
@faisal-alvi seems like maybe we could add that to https://github.com/10up/simple-local-avatars/blob/develop/.github/workflows/push-deploy.yml and potentially remove the minified JS file from the repo as that'll get generated as part of the WP.org deploy action? |
# Conflicts: # includes/class-simple-local-avatars.php # simple-local-avatars.dev.js
@claytoncollie I have merged
@jeffpaul can you please let me know if these are intentional behaviors or should be considered bugs? |
|
@faisal-alvi Part 1 is intended functionality. That is the entire reason behind storing the IDs in the options table. Our thinking was that if the site has a large number of users to migrate, the admin-ajax function might timeout before completion. And in that case, if it times out halfway through we have a record and can start over at the end of the record instead of from the very beginning. This might have been spoken about in this thread or on a zoom with @helen Part 2 seems to be a "feature" of WP User Avatar. That does make sense to me that a plugin name starting with the letter |
@claytoncollie thanks for the answers, @jeffpaul we are good to go 🚀 |
Provides admin-ajax and wp-cli methods for migrating avatars away from the WP User Avatar plugin.
Addresses #80
Verification Process
Visit /wp-admin/options-discussion.php to find the button at the bottom of the page to use the admin-ajax version.
Or run
simple-local-avatars migrate wp-user-avatar
to use the wp-cli version.In both cases, we create a database option
simple_local_avatars_migrations
to store previously migrated avatars.Checklist:
Changelog Entry