Skip to content
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

PM-11974: Fix login with device notification for inactive account not switching to that account #1157

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

matt-livefront
Copy link
Collaborator

@matt-livefront matt-livefront commented Nov 21, 2024

🎟️ Tracking

PM-11974

📔 Objective

This fixes receiving a login with device notification for an inactive account.

📸 Screenshots

ScreenRecording_11-21-2024.14-34-12_1.mov

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

@@ -308,14 +307,14 @@ class DefaultNotificationService: NotificationService {
let request = UNNotificationRequest(identifier: data.id, content: content, trigger: nil)
try await UNUserNotificationCenter.current().add(request)

// If the request is for the existing account, show the login request view automatically.
guard let loginRequest = try await authService.getPendingLoginRequest(withId: data.id).first
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This API request was being made if the login request was for an active or inactive user. And it fails for an inactive user since it has the wrong access token. This instead needs to happen after switching accounts if the request is for an inactive user.

Comment on lines -289 to +288
userEmail: loginSourceEmail
userId: loginSourceAccount.profile.userId
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This previously stored the email of the account that the request was for. Which would be problematic if there were multiple accounts with the same email. So I switched to the use the user ID.

Copy link

codecov bot commented Nov 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.42%. Comparing base (1f97eab) to head (99649bd).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1157      +/-   ##
==========================================
+ Coverage   89.38%   89.42%   +0.04%     
==========================================
  Files         688      688              
  Lines       43734    43727       -7     
==========================================
+ Hits        39090    39102      +12     
+ Misses       4644     4625      -19     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

Copy link
Contributor

Logo
Checkmarx One – Scan Summary & Detailse7b8134a-215d-4ad3-a197-aff4103a04e0

No New Or Fixed Issues Found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant