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 sidebar teams order #8281

Merged
merged 1 commit into from
Oct 30, 2024
Merged

Fix sidebar teams order #8281

merged 1 commit into from
Oct 30, 2024

Conversation

enahum
Copy link
Contributor

@enahum enahum commented Oct 23, 2024

Summary

The code to sort the teams based on the order established by the preferences wasn't working, the preferences are already sorted and if no preferences set we sort by the display name of the team.

Noticed this issue since we started to add more teams on Hub.

Ticket Link

https://mattermost.atlassian.net/browse/MM-60723

Release Note

Fixed sort of teams in the Team Sidebar by following the user preferences if set.

@enahum enahum added 2: Dev Review Requires review by a core commiter 3: QA Review Requires review by a QA tester labels Oct 23, 2024
@larkox
Copy link
Contributor

larkox commented Oct 23, 2024

@enahum Is this this ticket? https://mattermost.atlassian.net/browse/MM-60723

@enahum
Copy link
Contributor Author

enahum commented Oct 23, 2024

@enahum Is this this ticket? https://mattermost.atlassian.net/browse/MM-60723

@larkox seems to be the case

Copy link
Contributor

@larkox larkox left a comment

Choose a reason for hiding this comment

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

It looks fine, but one question before approving.

Are we positive o will always contain all teams? If not, we may "lose" teams with this change.

@enahum
Copy link
Contributor Author

enahum commented Oct 23, 2024

It looks fine, but one question before approving.

Are we positive o will always contain all teams? If not, we may "lose" teams with this change.

It should contain all of them. @hmhealey can you confirm?

@hmhealey
Copy link
Member

I don't believe we keep that preference in sync with the user's teams. If I remember right, the preference is only updated when a user reoreders their teams, so:

  1. It starts empty even when the user is on
  2. If a user joins a team, that won't be added to the preference and will have to be placed automatically
  3. If a user leaves a team, that team won't be removed from the preference, so the app will have to be able to handle an ID corresponding to a team the user doesn't have access to

The web app function for handling this is here: https://github.com/mattermost/mattermost/blob/master/webapp/channels/src/utils/team_utils.tsx#L18

@yasserfaraazkhan yasserfaraazkhan added the Build Apps for PR Build the mobile app for iOS and Android to test label Oct 24, 2024
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.

Tested on server v10.2.0 with 20+ teams. Reaggranging teams on Webapp will display same sequence on mobile app

@enahum enahum requested a review from larkox October 30, 2024 01:58
@enahum enahum merged commit 534aeaa into main Oct 30, 2024
36 checks passed
@enahum enahum deleted the sort-teams branch October 30, 2024 09:13
@hmhealey
Copy link
Member

hmhealey commented Oct 30, 2024

@enahum Did we address the case where the items in that array don't match the users' current teams? It doesn't seem like that was handled, so I don't think that the mobile app will show new teams that the user is added to now unless the user reorders their teams from the web app

@enahum
Copy link
Contributor Author

enahum commented Oct 31, 2024

@hmhealey you are saying that if:

  1. User orders the teams
  2. User is added to another team

The order preference is not updated and thus the team won't appear in the UI?

Please confirm this is the case, cause then is not handled and is also affecting other work I'm doing

@amyblais amyblais added this to the v2.23.0 milestone Oct 31, 2024
@enahum
Copy link
Contributor Author

enahum commented Oct 31, 2024

@hmhealey additionally can you confirm if these newly added teams would show above or below the ones you already ordered manually.

If above that would be better I think, specially when you are in a looooooooooot of teams already.

@enahum enahum mentioned this pull request Nov 1, 2024
1 task
@hmhealey
Copy link
Member

hmhealey commented Nov 5, 2024

@hmhealey you are saying that if:

1. User orders the teams

2. User is added to another team

The order preference is not updated and thus the team won't appear in the UI?

Please confirm this is the case, cause then is not handled and is also affecting other work I'm doing

I'm a bit late to reply, but yeah, that's correct.

@hmhealey additionally can you confirm if these newly added teams would show above or below the ones you already ordered manually.

The logic for that is in here. The order is:

  1. Any teams in the preference
  2. Any teams not in the preference, sorted alphabetically by display name

@enahum
Copy link
Contributor Author

enahum commented Nov 5, 2024

Changes for that here #8306

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2: Dev Review Requires review by a core commiter 3: QA Review Requires review by a QA tester Build Apps for PR Build the mobile app for iOS and Android to test release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants