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

Fix MM-61975 #8459

Merged
merged 11 commits into from
Feb 17, 2025
Merged

Fix MM-61975 #8459

merged 11 commits into from
Feb 17, 2025

Conversation

larkox
Copy link
Contributor

@larkox larkox commented Jan 8, 2025

Summary

Fix MM-61975

Ticket Link

Fix https://mattermost.atlassian.net/browse/MM-61975

Release Note

NONE

@larkox larkox added 2: Dev Review Requires review by a core commiter 3: QA Review Requires review by a QA tester labels Jan 8, 2025
@larkox larkox requested review from a team and BenCookie95 and removed request for a team January 8, 2025 13:14
@larkox larkox requested a review from rahimrahman January 8, 2025 13:14
@larkox larkox added the 2: UX Review Requires review by a UX Designer label Jan 8, 2025
@larkox larkox requested a review from abhijit-singh January 8, 2025 13:14
@larkox larkox added the 3: Security Review Review requested from Security Team label Jan 8, 2025
@larkox larkox requested a review from jupenur January 8, 2025 13:15
@abhijit-singh abhijit-singh added the Build Apps for PR Build the mobile app for iOS and Android to test label Jan 8, 2025
@@ -187,7 +187,7 @@ class SessionManager {

private onSessionExpired = async (serverUrl: string) => {
this.terminatingSessionUrl.add(serverUrl);
await logout(serverUrl, false, false, true);
await logout(serverUrl, undefined, true, false, true);

Choose a reason for hiding this comment

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

I'm unsure why we call this, we changed skipServerLogout to true and skipEvents is true. We won't do anything in logout apart from return {data: true};? Unless changing skipServerLogout to true was a mistake?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are completely right. But it makes kind of sense 😅

If the session expired, in theory it expired on the server, so we don't need to contact the server.
And if we are in this part of the code, is because the SESSION_EXPIRED event was triggered, so we don't have to trigger it again.

I guess we can remove the logout completely, yes, but I have mixed feelings because "logically" it makes sense to have it here.

Choose a reason for hiding this comment

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

So I guess this call is here in case there are changes to the logout function in future and we forget to add the call back to onSessionExpired? Should we add a comment above this call in case someone else removes it?

@abhijit-singh abhijit-singh added Build Apps for PR Build the mobile app for iOS and Android to test and removed Build Apps for PR Build the mobile app for iOS and Android to test labels Jan 13, 2025
@larkox larkox added Build Apps for PR Build the mobile app for iOS and Android to test and removed Build Apps for PR Build the mobile app for iOS and Android to test labels Jan 17, 2025
Copy link

@abhijit-singh abhijit-singh left a comment

Choose a reason for hiding this comment

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

Looks good to me

@larkox larkox requested a review from BenCookie95 February 4, 2025 16:10
@larkox
Copy link
Contributor Author

larkox commented Feb 4, 2025

@rahimrahman @jupenur Friendly reminder to review this

Copy link
Contributor

@rahimrahman rahimrahman left a comment

Choose a reason for hiding this comment

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

One small nit, but all good.


const body = logoutOnAlert ?
intl?.formatMessage({id: 'logout.fail.message.forced', defaultMessage: 'We could not log you out of the server. Data may continue to be accessible to this device once the device goes back online.'}) || 'We could not log you out of the server. Data may continue to be accessible to this device once the device goes back online.' :
intl?.formatMessage({id: 'logout.fail.message', defaultMessage: 'We could not log you out of the server. If you log out now, data may continue to be accessible to this device once the device goes back online. Do you still want to continue?'}) || 'We could not log you out of the server. If you log out now, data may continue to be accessible to this device once the device goes back online. Do you still want to continue?';
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: could potentially add to a variable so that you don't have to repeat twice?

@yasserfaraazkhan yasserfaraazkhan added Build Apps for PR Build the mobile app for iOS and Android to test and removed Build Apps for PR Build the mobile app for iOS and Android to test labels Feb 8, 2025
Copy link
Contributor

@yasserfaraazkhan yasserfaraazkhan left a comment

Choose a reason for hiding this comment

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

  • Verified if the server is not reachable. We will see the alert when trying to log out.
  • Verified if the loggin out is cancelled. When server connection is established, we use the app
  • Verified Logging out of multiple server when device is offline.

Comment on lines +468 to +473
"logout.fail.cancel": "Cancel",
"logout.fail.continue_anyway": "Continue Anyway",
"logout.fail.message": "You’re not fully logged out. Some data may continue to be accessible to this device once the device goes back online. What do you want to do?",
"logout.fail.message.forced": "We could not log you out of the server. Some data may continue to be accessible to this device once the device goes back online.",
"logout.fail.ok": "OK",
"logout.fail.title": "Logout not complete",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cwarnermm I updated the texts. Let me know if I missed anything (apart of the retry button)

Copy link
Member

Choose a reason for hiding this comment

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

thank you!!

@larkox
Copy link
Contributor Author

larkox commented Feb 10, 2025

@abhijit-singh Any opinion on adding a retry button? My concern is that it will clutter the alert with too many buttons and too many options. But 0/5.

@abhijit-singh
Copy link

@larkox Agreed. I'd hold back on adding a retry button right now. This is an improvement already.

@larkox larkox requested a review from jupenur February 14, 2025 09:29
@larkox larkox added QA Review Done and removed 3: QA Review Requires review by a QA tester labels Feb 14, 2025
@larkox
Copy link
Contributor Author

larkox commented Feb 14, 2025

@jupenur I re-requested your review since it was not yet approved, and for a final check before merging.

Copy link
Member

@jupenur jupenur left a comment

Choose a reason for hiding this comment

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

LGTM. And Copilot also says it's great 🤖 #tryAI

@larkox larkox added 4: Reviews Complete All reviewers have approved the pull request and removed 3: Security Review Review requested from Security Team labels Feb 17, 2025
@larkox larkox merged commit 779fe31 into main Feb 17, 2025
27 checks passed
@larkox larkox deleted the alertLogout branch February 17, 2025 12:45
@amyblais
Copy link
Member

/cherry-pick release-2.25

@mattermost-build
Copy link
Contributor

Cherry pick is scheduled.

@amyblais
Copy link
Member

/cherry-pick release-2.26

@mattermost-build
Copy link
Contributor

Cherry pick is scheduled.

@mattermost-build
Copy link
Contributor

Error trying doing the automated Cherry picking. Please do this manually

+++ Updating remotes...
Fetching upstream
hostfile_replace_entries: mkstemp: Read-only file system
update_known_hosts: hostfile_replace_entries failed for /app/.ssh/known_hosts: Read-only file system
From github.com:mattermost/mattermost-mobile
 * [new branch]          build-release-606      -> upstream/build-release-606
   179738038..15a3f491f  edit_profile_cpa       -> upstream/edit_profile_cpa
   ef37432e0..0b1840a7d  feature_schedule_posts -> upstream/feature_schedule_posts
   24e675048..e8d72d8a8  main                   -> upstream/main
 * [new branch]          reportAProblem         -> upstream/reportAProblem
   f00ecc0b0..cd9fc571c  schedule_post_list     -> upstream/schedule_post_list
   014062f78..b9d1ca877  scheduled_post_feature_popup -> upstream/scheduled_post_feature_popup
Fetching upstream
hostfile_replace_entries: mkstemp: Read-only file system
update_known_hosts: hostfile_replace_entries failed for /app/.ssh/known_hosts: Read-only file system
+++ Updating remotes done...
+++ Creating local branch automated-cherry-pick-of-mattermost-mobile-#8459-upstream-release-2.25-1739864575
Switched to a new branch 'automated-cherry-pick-of-mattermost-mobile-#8459-upstream-release-2.25-1739864575'
Branch 'automated-cherry-pick-of-mattermost-mobile-#8459-upstream-release-2.25-1739864575' set up to track remote branch 'release-2.25' from 'upstream'.

+++ About to attempt cherry pick of PR #8459 with merge commit 779fe31c3bcb1c8753402e6424219b27a11b2db7.

CONFLICT (modify/delete): app/managers/session_manager.test.ts deleted in HEAD and modified in 779fe31c3 (Fix MM-61975 (#8459)).  Version 779fe31c3 (Fix MM-61975 (#8459)) of app/managers/session_manager.test.ts left in tree.
Auto-merging app/managers/session_manager.ts
Auto-merging assets/base/i18n/en.json
error: could not apply 779fe31c3... Fix MM-61975 (#8459)
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".
!!! git cherry-pick failed

+++ Aborting in-progress git cherry-pick.

+++ Returning you to the master branch and cleaning up.

mattermost-build pushed a commit that referenced this pull request Feb 18, 2025
* Fix MM-61975

* Add missing strings

* Ensure the app gets logged out after not accepting the ToS

* Fix i18n and add comment

* Fix tests and address feedback

* Check for the right value coming from status

* Update texts

(cherry picked from commit 779fe31)
@mattermost-build mattermost-build added the CherryPick/Done Successfully cherry-picked to the quality or patch release tracked in the milestone label Feb 18, 2025
@amyblais amyblais added this to the v2.26.0 milestone Feb 18, 2025
amyblais pushed a commit that referenced this pull request Feb 18, 2025
* Fix MM-61975

* Add missing strings

* Ensure the app gets logged out after not accepting the ToS

* Fix i18n and add comment

* Fix tests and address feedback

* Check for the right value coming from status

* Update texts

(cherry picked from commit 779fe31)

Co-authored-by: Daniel Espino García <larkox@gmail.com>
Willyfrog pushed a commit that referenced this pull request Feb 19, 2025
* Fix MM-61975

* Add missing strings

* Ensure the app gets logged out after not accepting the ToS

* Fix i18n and add comment

* Fix tests and address feedback

* Check for the right value coming from status

* Update texts
Rajat-Dabade pushed a commit that referenced this pull request Feb 25, 2025
* Fix MM-61975

* Add missing strings

* Ensure the app gets logged out after not accepting the ToS

* Fix i18n and add comment

* Fix tests and address feedback

* Check for the right value coming from status

* Update texts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4: Reviews Complete All reviewers have approved the pull request Build Apps for PR Build the mobile app for iOS and Android to test CherryPick/Done Successfully cherry-picked to the quality or patch release tracked in the milestone QA Review Done release-note-none
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants