Skip to content

Commit

Permalink
(PC-32561)[BO] fix: conditions for email updated icon
Browse files Browse the repository at this point in the history
(cherry picked from commit 6c15b7e)
  • Loading branch information
prouzet-pass committed Nov 12, 2024
1 parent d78a1ae commit 21dbaed
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 0 additions & 1 deletion api/src/pcapi/core/users/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,6 @@ def search_public_account_in_history_email(search_query: str) -> BaseQuery:
models.UserEmailHistory.eventType.in_(
{
models.EmailHistoryEventTypeEnum.NEW_EMAIL_SELECTION,
models.EmailHistoryEventTypeEnum.CONFIRMATION,
models.EmailHistoryEventTypeEnum.VALIDATION,
models.EmailHistoryEventTypeEnum.ADMIN_VALIDATION,
models.EmailHistoryEventTypeEnum.ADMIN_UPDATE,
Expand Down
5 changes: 3 additions & 2 deletions api/src/pcapi/routes/backoffice/accounts/blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,9 @@ def render_public_account_details(
has_changed_email = any(
email_event.eventType
not in (
users_models.EmailHistoryEventTypeEnum.UPDATE_REQUEST,
users_models.EmailHistoryEventTypeEnum.NEW_EMAIL_SELECTION,
users_models.EmailHistoryEventTypeEnum.UPDATE_REQUEST, # step 1/4
users_models.EmailHistoryEventTypeEnum.CONFIRMATION, # step 2/4
users_models.EmailHistoryEventTypeEnum.NEW_EMAIL_SELECTION, # step 3/4
users_models.EmailHistoryEventTypeEnum.CANCELLATION,
)
for email_event in user.email_history
Expand Down
4 changes: 3 additions & 1 deletion api/tests/routes/backoffice/accounts_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,7 @@ def test_get_suspended_public_account(self, legit_user, authenticated_client):
def test_get_public_account_with_unconfirmed_modified_email(self, authenticated_client):
user = users_factories.UserFactory()
users_factories.EmailUpdateEntryFactory(user=user)
users_factories.EmailConfirmationEntryFactory(user=user)
users_factories.NewEmailSelectionEntryFactory(user=user)
user_id = user.id

Expand All @@ -703,8 +704,9 @@ def test_get_public_account_with_unconfirmed_modified_email(self, authenticated_
def test_get_public_account_with_confirmed_modified_email(self, authenticated_client):
user = users_factories.UserFactory()
users_factories.EmailUpdateEntryFactory(user=user)
users_factories.NewEmailSelectionEntryFactory(user=user)
users_factories.EmailConfirmationEntryFactory(user=user)
users_factories.NewEmailSelectionEntryFactory(user=user)
users_factories.EmailValidationEntryFactory(user=user)
user_id = user.id

with assert_num_queries(self.expected_num_queries):
Expand Down

0 comments on commit 21dbaed

Please sign in to comment.