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

getUsersSidebarCategories incorrectly reports "sorting" value #22445

Closed
theAkito opened this issue Mar 6, 2023 · 4 comments
Closed

getUsersSidebarCategories incorrectly reports "sorting" value #22445

theAkito opened this issue Mar 6, 2023 · 4 comments
Assignees
Labels
Help Wanted Community help wanted

Comments

@theAkito
Copy link

theAkito commented Mar 6, 2023

Summary

When creating a new Category via CreateSidebarCategoryForTeamForUser with the following payload

{
  "user_id": "user_id",
  "team_id": "team_id",
  "display_name": "My Category",
  "type": "custom",
  "sorting": "manual"
}

then retrieving all the categories from the user via GetSidebarCategoriesForTeamForUser results in the previously created Category containing an empty string as the value for "sorting" in the returned array of Category objects.

Steps to reproduce

  1. Create a new Category via CreateSidebarCategoryForTeamForUser with "sorting": "manual".
  2. Retrieve all categories from the user via GetSidebarCategoriesForTeamForUser and notice, how "sorting": "".

Expected behavior

Sorting attribute should be reported, correctly.

Observed behavior (that appears unintentional)

The API wasn't aware of this issue.

In the GUI, the sorting was set to "manual". It might also be the case, that during the creation of a category the sorting attribute is ignored, which would be something to fix, either way.

Workaround

Update User's Sidebar Categories via UpdateSidebarCategoryForTeamForUser or UpdateSidebarCategoriesForTeamForUser with "sorting": "manual" re-added, after retrieving the current category state via GetSidebarCategoriesForTeamForUser.

@amyblais
Copy link
Member

amyblais commented Mar 6, 2023

@theAkito What Mattermost server version are you on?

@theAkito
Copy link
Author

theAkito commented Mar 6, 2023

Mattermost Version: 7.5.2
Database Schema Version: 95
Database: postgres

@amyblais
Copy link
Member

amyblais commented Mar 6, 2023

Opened https://mattermost.atlassian.net/browse/MM-51089.

@amyblais amyblais added the Bug Report/Open Bug report/issue label Mar 6, 2023
@tanmaydatta
Copy link
Contributor

Hi
As theAkito suggested in the initial post, the sorting attribute is actually being ignored. Code pointer = https://github.com/mattermost/mattermost-server/blob/master/store/sqlstore/channel_store_categories.go#L338

I will fix this and soon raise a PR
This is the first time I am going to contribute, please let me know if need to take care of something else.
Thanks

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

No branches or pull requests

3 participants