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

Project List has a limit of 50 #955

Closed
DanTitovTulip opened this issue Jul 7, 2023 · 9 comments · Fixed by #1004
Closed

Project List has a limit of 50 #955

DanTitovTulip opened this issue Jul 7, 2023 · 9 comments · Fixed by #1004
Labels
Type/Bug Something isn't working

Comments

@DanTitovTulip
Copy link

Our Jira instance has hundreds of projects and I am part of a group that has access to all of them.

When I try to use /jira subscribe only the first 50 projects are in the list, alphabetically. I am not able to scroll down to see the rest.

Steps to Reproduce:

  1. /Jira connect in MM channel
  2. /Jira subscribe in MM channel
  3. Select "Project" dropdown
  4. Scroll all the way to the end

Expected Result: I can see all of the projects I have access to.
Actual Result: The project list ends at 50 projects.

Impact: Currently the only workaround to this is to create more Jira user groups with specific project access. Most likely won't be using this feature until this is resolved.

Please let me know if there is a better workaround available.

@Westacular
Copy link

I think I see the bug:

In client_cloud.go ListProjects: https://github.com/mattermost/mattermost-plugin-jira/blob/master/server/client_cloud.go#L110

When limit = -1 to trigger the "fetchAll" behaviour, the revenant code is

	remaining := 50
	...
	for {
		...
		if len(result.Values) > remaining {
			result.Values = result.Values[:remaining]
		}
		out = append(out, result.Values...)
		remaining -= len(result.Values)

		if !fetchAll && remaining == 0 {
			// Got enough.
			return out, nil
		}
		if len(result.Values) == 0 || result.IsLast {
			// Ran out of results.
			return out, nil
		}
	}

When fetchAll is true, remaining is still set to 50, and it still gets (a) used to truncate result.Values, and (b) decremented by len(result.Values). Which means that after the first pass through the loop, remaining will be set to 0, and on the second pass, it will request maxResults=0, result.Values will be truncated to 0 length, and it will hit the last if and return just the first 50 results.

Changing

		remaining -= len(result.Values)

		if !fetchAll && remaining == 0 {
			// Got enough.
			return out, nil
		}

to

		if !fetchAll {
			remaining -= len(result.Values)
			if remaining == 0 {
				// Got enough.
				return out, nil
			}
		}

such that remaining is never decremented when fetchAll is true should fix this, I think.

@ueberBrot
Copy link

ueberBrot commented Aug 29, 2023

It's not only in the subscribe dialogue, it's also in the project dropdown when creating an issue. The limit is 50 there too and the autocomplete can only search through those 50 items.

A PR would be much appreciated 🙏

@Kshitij-Katiyar Kshitij-Katiyar added the Type/Bug Something isn't working label Aug 30, 2023
raghavaggarwal2308 added a commit to Brightscout/mattermost-plugin-jira that referenced this issue Sep 4, 2023
raghavaggarwal2308 added a commit to Brightscout/mattermost-plugin-jira that referenced this issue Sep 12, 2023
…values (#67)

* [MI-3466] Fix Jira issue mattermost#955: Save user's last used field values

* [MI-3466] Code refactoring

* [MI-3466] Fixed issue: not able to select prject while creating subscriptions

* [MI-3466] Review fixes
@qunabu
Copy link

qunabu commented Oct 3, 2023

The Project Dropdown in either attaching message to jira issue or creating subscription is limited to 50 records

Possible solutions

  • typing query should refresh list like in users dropdown
  • more projects should be fetched initially

@relwell
Copy link
Contributor

relwell commented Oct 11, 2023

This is biting my team as well. It looks like a related MR has already been merged. Can we get an update on when a fix for this will roll out?

@cjonard
Copy link

cjonard commented Nov 3, 2023

Hello, do we have any more information? This fix is eagerly awaited by my team too.

@MouradHM
Copy link

MouradHM commented Nov 3, 2023

Hello,

It's can we have an update on that issues ? It's becoming urgent among my organization too.

@Fburbaud
Copy link

Fburbaud commented Nov 6, 2023

Hi,
Same here. An update or a fix would be nice. Thanks

@relwell
Copy link
Contributor

relwell commented Dec 11, 2023

Is this something we can please get taken care of soon? Even a hard-coded bump in the limit of projects would be a big help.

relwell pushed a commit to relwell/mattermost-plugin-jira that referenced this issue Dec 11, 2023
mickmister pushed a commit that referenced this issue Dec 22, 2023
Co-authored-by: Bob Elwell <belwell@vultr.com>
@qunabu
Copy link

qunabu commented Jan 15, 2024

thanks for resolving this much appreciated

mickmister pushed a commit that referenced this issue Mar 14, 2024
* [MI-3466] Fix Jira issue #855: Save user's last used field values (#67)

* [MI-3466] Fix Jira issue #955: Save user's last used field values

* [MI-3466] Code refactoring

* [MI-3466] Fixed issue: not able to select prject while creating subscriptions

* [MI-3466] Review fixes

* Review fix

* [MI-3690] Removed the logic to save the component field
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type/Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants