agileware-jp / redmine_issue_templates

Redmine Issue Template. Pull requests, reporting issues, stars and sponsoring are always welcome!
https://www.redmine.org/plugins/redmine_issue_templates
GNU General Public License v2.0
65 stars 28 forks source link

Cannot set watcher for more than 21 default members #31

Open Araki-Tokyo opened 1 year ago

Araki-Tokyo commented 1 year ago

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[bot] commented 1 year ago

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

akiko-pusu commented 1 year ago

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

Now I am not the maintainer, but this feature has been added at https://github.com/akiko-pusu/redmine_issue_templates/issues/302.

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

https://github.com/agileware-jp/redmine_issue_templates/blob/aea59f3e6a93e50f77bed1b8e17aefe60e9cee95/app/controllers/concerns/issue_templates_common.rb#L110-L118

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://github.com/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 commented 1 year ago

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.) https://github.com/agileware-jp/redmine_issue_templates/pull/32#issuecomment-1179520751

Thanks!