Skip to content

chore(client): stop replacing Meteor.user#32910

Merged
ggazzo merged 8 commits intodevelopfrom
chore/meteor-user-collection
Jul 26, 2024
Merged

chore(client): stop replacing Meteor.user#32910
ggazzo merged 8 commits intodevelopfrom
chore/meteor-user-collection

Conversation

@ggazzo
Copy link
Copy Markdown
Member

@ggazzo ggazzo commented Jul 26, 2024

After a change in Meteor (meteor 3.0.0), where Accounts.callLoginMethod trusts that Accounts.user.find is still there to call the login callbacks, it became clear that it is not healthy to rewrite internal framework objects.

...
...
But no one has proof that adding extra methods causes problems :)

Proposed changes (including videos or screenshots)

Issue(s)

Steps to test or reproduce

Further comments

CORE-578

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Jul 26, 2024

⚠️ No Changeset found

Latest commit: 5d24a88

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot bot commented Jul 26, 2024

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is targeting the wrong base branch. It should target 6.12.0, but it targets 6.11.0

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@codecov
Copy link
Copy Markdown

codecov bot commented Jul 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 55.53%. Comparing base (978e2d1) to head (5d24a88).
Report is 4 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop   #32910   +/-   ##
========================================
  Coverage    55.53%   55.53%           
========================================
  Files         2637     2637           
  Lines        57439    57443    +4     
  Branches     11903    11906    +3     
========================================
+ Hits         31897    31900    +3     
+ Misses       22823    22822    -1     
- Partials      2719     2721    +2     
Flag Coverage Δ
e2e 54.06% <100.00%> (+<0.01%) ⬆️
unit 72.36% <100.00%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

@ggazzo ggazzo changed the title chore(client): keep same Meteor.user chore(client): stop replacing Meteor.user Jul 26, 2024
@ggazzo ggazzo added this to the 6.12 milestone Jul 26, 2024
@ggazzo ggazzo marked this pull request as ready for review July 26, 2024 12:45
@ggazzo ggazzo requested a review from a team as a code owner July 26, 2024 12:45
@ggazzo ggazzo force-pushed the chore/meteor-user-collection branch from ce1d5b1 to e107adf Compare July 26, 2024 14:38
Comment on lines -41 to -54
const userId = useUserId();
useEffect(() => {
if (!userId) {
return;
}

router.navigate(
{
pathname: '/home',
},
{ replace: true },
);
}, [userId, router]);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just trying to understand: why are we removing this?
Shouldn't we keep redirecting the user to the homepage in case they are already logged in RC when accessing this page?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Pierre had done a workaround, for some reason, in Meteor 3.0.0 this callback would never be called. However, in Meteor 2.0.0 it happens.

If you stop to think about it, it doesn't make sense to redirect the user after logging in if he doesn't have a uid, because that means it failed.

Likewise, it doesn't make sense to redirect twice if it works.

You even did a test to see if it redirects to the home page twice, that's going to be quite interesting.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looking at this file now, one thing that I find weird is that we're doing the redirects (to home or to redirectUrl) even if the callback is called with an error. Shouldn't this happen only on successful login (specially for the redirectUrl)?

I think we should add an extra test forcing some kind of error to happen on this last step of the login method to ensure the client is behaving as it should.
We have e2e tests for errors on loginWithSaml, but none with errors on loginWithSamlToken. On the unit tests for the view, the mocked function never sends any errors.

@ggazzo ggazzo added the stat: QA assured Means it has been tested and approved by a company insider label Jul 26, 2024
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Jul 26, 2024
@ggazzo ggazzo merged commit 776fc1e into develop Jul 26, 2024
@ggazzo ggazzo deleted the chore/meteor-user-collection branch July 26, 2024 18:55
gabriellsh added a commit that referenced this pull request Jul 31, 2024
…ove/threadMetrics

* 'develop' of github.com:RocketChat/Rocket.Chat: (26 commits)
  chore: Bump rocket.chat to 6.12.0-develop (#32936)
  test: Move Jest configuration to a package of presets (#32802)
  chore: bump turbo (#32938)
  feat: New users page deactivated tab and active tab ui (#32032)
  chore: bump traefik (#32892)
  test: fix flaky test `Archive department` (#32933)
  fix(Livechat): `After Registration Triggers` showing in wrong screen (#32928)
  refactor: Remove deprecated `Options.AvatarSize` constant (#32909)
  chore: improve `on login` cached collection (#32929)
  i18n: Rocket.Chat language update from Lingohub 🤖 on 2024-07-25Z (#32908)
  refactor: Circular imports (#32885)
  regression: notify user properly on logout (#32920)
  chore(client): stop replacing  `Meteor.user` (#32910)
  regression: Messagebox sending message instead of just selecting popup suggestion (#32890)
  refactor: move broadcastMessageFromData to notifyListener (#32843)
  chore: prevent destructuring _id of deleted users (#32899)
  ci: increase kernel limits (#32902)
  ci: lint issues
  Release 6.10.1
  fix: imported fixes (#32894)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants