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

Cannot set watcher for more than 21 default members #31

Open
Araki-Tokyo opened this issue Jul 6, 2022 · 3 comments
Open

Cannot set watcher for more than 21 default members #31

Araki-Tokyo opened this issue Jul 6, 2022 · 3 comments

Comments

@Araki-Tokyo
Copy link

If there are 20 or less project members, you can use the ticket template to set up watcher as the default member.
However, if there are more than 21 project members, the "Select Field" list value will not be displayed at all, and watcher settings will not be possible.
I would like to be able to set watchers as default members even if there are more than 21 project members.
Could some of you please make this happen?

@github-actions
Copy link

github-actions bot commented Jul 6, 2022

Thank you for contributing to Redmine Issue Templates plugin!' first issue

@akiko-pusu
Copy link

Hi, @Araki-Tokyo
Thank you for reporting this issue.

Now I am not the maintainer, but this feature has been added at akiko-pusu#302.

The part where the watcher is selected is implemented using Redmine's native helper method.

if field == 'watcher_user_ids' && project_id.present?
issue = Issue.new(tracker_id: tracker_id, project_id: project_id)
watchers = helpers.users_for_new_issue_watchers(issue)
value[:field_format] = 'list'
value[:possible_values] = watchers.map { |user| "#{user.name} :#{user.id}" }
value[:name] = I18n.t('field_watcher')
value[:multiple] = true
end

So, as you can see from the method on the Redmine side, a limit of 21 names is set. ( IssuesHelper#users_for_new_issue_watchers )

https:/redmine/redmine/blob/3686b77eb60d4f4028977d5c4b1a7c039ee9b0bb/app/helpers/issues_helper.rb#L433-L442

  # Returns an array of users that are proposed as watchers
  # on the new issue form
  def users_for_new_issue_watchers(issue)
    users = issue.watcher_users.select{|u| u.status == User::STATUS_ACTIVE}
    assignable_watchers = issue.project.principals.assignable_watchers.limit(21)
    if assignable_watchers.size <= 20
      users += assignable_watchers.sort
    end
    users.uniq
  end

Suggestion

A. If you think this experimental feature is useful (built-in fields / custom fields select), you can apply this helper method and set up your own method in the Issue Template.

B. Alternatively, you can submit a request to the Redmine repository itself to be able to retrieve all watcher lists, or a list with a user-specified limit.

Personally, I think proposal B is the way to go.
If you are interested in OSS activities, you could create a pull request in either repository.

Also, I didn't get much feedback on this experimental feature when I added it, so this feature may be discontinued in the future in favor of stability and maintainability.
Please give it a +1 if you think it is valid.

@sanak
Copy link

sanak commented Jul 9, 2022

Hi,

Thanks for the useful information!

I tried above Suggestion - A way on PR #33, and it seems to work as I expected. 😄

(Related comments are other PR #32 side.)
#32 (comment)

Thanks!

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

Successfully merging a pull request may close this issue.

3 participants