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

bfix: handles error incase of unsuccessful logout #2420

Merged
merged 4 commits into from
Mar 23, 2024

Conversation

am-casper
Copy link
Contributor

What kind of change does this PR introduce?
This fixes a bug. Error handing in case of unsuccessful logging out is improved.

Issue Number: #2416

Fixes #2416

Did you add tests for your changes?

Updated a couple of tests.

Summary

As a user, i don't want to not able to log out properly and stuck between the App Settings and Select Language screen, everytime a logout is unsuccessful.

Does this PR introduce a breaking change?

This fixes a critical bug, especially for users who have unstable internet connection.

Have you read the contributing guide?

Yes

Copy link

Our Pull Request Approval Process

We have these basic policies to make the approval process smoother for our volunteer team.

Testing Your Code

Please make sure your code passes all tests. Our test code coverage system will fail if either of these two conditions occur:

  1. The overall code coverage drops below the target threshold of the repository
  2. Any file in the pull request has code coverage levels below the repository threshold

The process helps maintain the overall reliability of the code base and is a prerequisite for getting your PR approved. Assigned reviewers regularly review the PR queue and tend to focus on PRs that are passing.

Reviewers

Do not assign reviewers. Our Queue Monitors will review your PR and assign them.
When your PR has been assigned reviewers contact them to get your code reviewed and approved via:

  1. comments in this PR or
  2. our slack channel

Reviewing Your Code

Your reviewer(s) will have the following roles:

  1. arbitrators of future discussions with other contributors about the validity of your changes
  2. point of contact for evaluating the validity of your work
  3. person who verifies matching issues by others that should be closed.
  4. person who gives general guidance in fixing your tests

Other

🎯 Please be considerate of our volunteers' time. Contacting the person who assigned the reviewers is not advised unless they ask for your input. Do not @ the person who did the assignment otherwise.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Congratulations on making your first PR! 🎊 If you haven't already, check out our Contributing Guidelines and PR Reporting Guidelines to ensure that you are following our guidelines for contributing and creating PR.

Copy link

codecov bot commented Mar 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.74%. Comparing base (8652d99) to head (26aba3c).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #2420   +/-   ##
========================================
  Coverage    95.74%   95.74%           
========================================
  Files          152      152           
  Lines         7518     7518           
========================================
  Hits          7198     7198           
  Misses         320      320           

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

@am-casper am-casper force-pushed the logout-issue branch 4 times, most recently from cf3997d to 18b869f Compare March 12, 2024 16:19
@dhanagopu dhanagopu requested review from Kevoniat and CyberWake March 13, 2024 04:47
@dhanagopu
Copy link

@CyberWake @Kevoniat Can you review this PR?

@noman2002
Copy link
Member

@am-casper Please attach a video.

@am-casper
Copy link
Contributor Author

am-casper commented Mar 15, 2024

@noman2002 This is after the bug fix. Before the bug was fixed, app crashes after logout if internet connectivity is weak
https://github.com/PalisadoesFoundation/talawa/assets/103204377/ba41e69b-c28b-4e2a-a79a-5f6258877c61

Copy link
Member

@noman2002 noman2002 left a comment

Choose a reason for hiding this comment

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

When logged out, navigate it to the login screen not on the language selection screen.

@am-casper am-casper force-pushed the logout-issue branch 3 times, most recently from 7e73d75 to 7c49ced Compare March 18, 2024 14:22
@am-casper
Copy link
Contributor Author

When logged out, navigate it to the login screen not on the language selection screen.

@noman2002 updated the commit. Kindly have a look

final bool isLogoutSuccessful =
await model.logout();
if (!isLogoutSuccessful) {
throw Error(); //checks whether the logout was successful or not.
Copy link
Member

Choose a reason for hiding this comment

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

Where is this error catched ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@literalEval there's a catch block at line 316. please have a look at it.

@@ -14,10 +14,11 @@ class AppSettingViewModel extends BaseModel {
/// None
///
/// **returns**:
/// None
Future<void> logout() async {
/// * `Future<bool>`: A [Future] that resolves to a [bool] value indicating whether the user has been logged out.
Copy link
Member

Choose a reason for hiding this comment

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

Write a small non-redundant sentence.
Like: "Logs the user out and returns logout status"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@literalEval updated.

@palisadoes
Copy link
Contributor

This is an update on the PR merging freeze:

  1. In the next few hours we will be merging the develop-userTypeFix branch into the develop branch.
  2. The develop-userTypeFix branch was created to fix a long standing design flaw where Admins were Admins of all organizations, not specific ones.
  3. The userType field has been removed from the User collection and it has been replaced by an appUserProfileId field.
    1. This field is null if the user isn’t registered to use the apps. This will help people to add users manually during the event checkin process, or if an Admin wants to manually add someone in the Admin dashboard.
    2. When not null the AppUserProfileID will reference a AppUserProfile collection with App related information such as the organizations for which a user may be an Admin.
    3. The updated schema can be found here https://github.com/PalisadoesFoundation/talawa-api/blob/develop-userTypeFix/schema.graphql
    4. This is the parent issue that we have been using to track progress:
      1. PARENT ISSUE: Fix the usage of userType talawa-api#1965
  4. This merge will cause some conflicts in your PR.

We decided to do this at the beginning of the weekend to give us all time to adjust PR code and create bug fixes that may arise.

Update your code at or after midnight GMT on the morning of March 23, 2024. (5:30am IST).

If your PRs have already been approved, request a re-review after fixing the conflicts and refactoring to the new AppUserProfileID methodology.

@noman2002 noman2002 requested a review from literalEval March 23, 2024 15:17
Copy link
Member

@noman2002 noman2002 left a comment

Choose a reason for hiding this comment

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

Looks fine to me.

@palisadoes palisadoes merged commit 3151796 into PalisadoesFoundation:develop Mar 23, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

logout button lands to Select Language page even when logout is not successful.
5 participants