Skip to content

Commit

Permalink
Issue #3432109: Add new route /my-settings to redirect users to the…
Browse files Browse the repository at this point in the history
…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`.
  • Loading branch information
tregismoreira committed Mar 28, 2024
1 parent a77a072 commit 39b9720
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions modules/social_features/social_user/social_user.routing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,10 @@ social_user.stream:
requirements:
_user_is_logged_in: 'TRUE'
_custom_access: '\Drupal\social_user\Controller\SocialUserController::accessUsersPages'

social_user.my_settings:
path: '/my-settings'
defaults:
_controller: '\Drupal\user\Controller\UserController::userEditPage'
requirements:
_user_is_logged_in: 'TRUE'
12 changes: 12 additions & 0 deletions tests/behat/features/capabilities/account/my-settings-page.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@api
Feature: Redirect user to their settings page
Benefit: To make it easier for users to access their settings page
Role: As a Authenticated
Goal/desire: I want to be redirected to "/user/*/edit" when I go to "/my-settings"

Scenario: A user is redirected to their settings page
Given I am logged in as a user with the "authenticated" role

When I go to "/my-settings"

Then the URL should match "^\/user\/[^\/]+\/edit$"

0 comments on commit 39b9720

Please sign in to comment.