-
Notifications
You must be signed in to change notification settings - Fork 168
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
Issue #3432109: Add new route /my-settings
to redirect users to their settings page
#3824
Conversation
Thanks for contributing towards Open Social! A maintainer from the @goalgorilla/maintainers group might not review all changes from all teams/contributors. Please don't be discouraged if it takes a while. In the meantime, we have some automated checks running and it might be that you will see our comments with some tips or requests to speed up the review process. 😊 |
2d3cfb1
to
ff9270b
Compare
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.
Hey Thiago,
This looks like a good improvement to add consistency to the set of /my-*
routes we already have! :D
To make sure this keeps working (since people may bookmark it for example) I think we might benefit from a Behat test that ensures that when you're logged in and you go to /my-settings
you end up on your settings edit page.
With that test we can also do some refactoring and remove the need for a custom route in social_user.routing.yml
and the method in SocialUserController
. The redirect behaviour we have here is provided for us by Drupal Core in the path_alias
module which is already enabled in Open Social by default. We could create a path alias in hook_install to let that module take care of it: https://drupal.stackexchange.com/a/291584/2166
Finally, while I'm excited to see code improvements that remove lines from the PHPStan baseline 🎉 it's usually a good idea to pull those out to a separate PR. This makes reviewing the PRs easier because they're more focused on a specific change and don't need to check whether the other change has impact on what's being described in the PR message.
Let me know if you need any help! :D
Hi @Kingdutch. Thanks for your feedback :) As we discussed internally, instead of using a path alias, I've replaced the custom route controller by the core Besides, I've also added a Behat test to make sure the Looking forward to your feedback. |
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.
Great! Thanks Thiago 💪
Final point will be picked up in new 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.
The only thing left to do before we merge this is to clean up the commits :D We currently rebase all our PRs onto main
when merging which causes a linear history. To ensure that history stays readable we try to avoid commits that simply say "Fix " since those commits don't really communicate intention and they're really all part of the work for the first commit :)
You can git rebase
the branch locally to squash all commits into a small number of commits that document the intended changes (for this PR that could be just the first one).
Your initial commit "Issue #3432109: Add new route /my-settings to redirect users to their settings page" communicates what we do very well. I think on Slack we've had some discussion on why we ended up choosing to create the route and have it point to the existing controller. Summarising that in the body of the commit message will help developers in the future (which might be us) to see why we choose a certain solution and make an informed decision of whether those reasons have perhaps changed :)
0cfda2c
to
376564c
Compare
…ir settings page In order to help users going to their settings page, this commit is adding: - A new custom route which path is `/my-settings`, using the core controller `\Drupal\user\Controller\UserController::userEditPage` so we don't need to maintain in ourselves; - A Behat test to check if the route is properly redirection users to `/users/*/edit`.
376564c
to
39b9720
Compare
@Kingdutch the PHPStan fix was actually only needed because in my first solution I was creating a custom method to use in the route controller. Now that we are not changing So I've removed the fix from this PR, and squashed the other commits to make it cleaner. We can create a separate PR with this fix later. |
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.
Focused and tested PR 🎉
🍒 picked to 12.4.x as 379c1f3 |
Problem
Currently, there is no easy way for users to go to their settings page unless they know their User ID, given that the path to the original route is
/user/{user}/edit
. It makes the UX to be somehow degraded.Solution
The solution is to create a custom route
/my-settings
which redirects the users to their settings page, so they don't need to think about it.The same approach is already applied to other extensions (eg.
/my-invites
and/my-events
).Issue tracker
Theme issue tracker
N/A
How to test
feature/3432109-new-route-my-settings
of Open Social/my-settings
page/user/{user}/edit
pageDefinition of done
Before merge
After merge
Screenshots
N/A
Release notes
N/A
Change Record
N/A
Translations
N/A