Feature #43997 » 0001-Add-setting-to-always-include-issue-authors-in-assig.patch
| app/models/issue.rb | ||
|---|---|---|
|
return [] if project.nil?
|
||
|
users = project.assignable_users(tracker).to_a
|
||
|
users << author if author && author.active?
|
||
|
if Setting.always_add_issue_author_to_assignable_users? && author&.active?
|
||
|
users << author
|
||
|
end
|
||
|
if assigned_to_id_was.present? && assignee = Principal.find_by_id(assigned_to_id_was)
|
||
|
users << assignee
|
||
|
end
|
||
| app/views/settings/_issues.html.erb | ||
|---|---|---|
|
<p><%= setting_select :assignee_dropdown_display_format, assignee_dropdown_display_format_options %></p>
|
||
|
<p><%= setting_check_box :always_add_issue_author_to_assignable_users %></p>
|
||
|
<p><%= setting_check_box :default_issue_start_date_to_creation_date %></p>
|
||
|
<%
|
||
| config/locales/en.yml | ||
|---|---|---|
|
setting_gantt_months_limit: Maximum number of months displayed on the gantt chart
|
||
|
setting_issue_group_assignment: Allow issue assignment to groups
|
||
|
setting_assignee_dropdown_display_format: Assignee drop-down display format
|
||
|
setting_always_add_issue_author_to_assignable_users: Always allow issue assignment to the author
|
||
|
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
|
||
|
setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
|
||
|
setting_unsubscribe: Allow users to delete their own account
|
||
| config/settings.yml | ||
|---|---|---|
|
default: 0
|
||
|
assignee_dropdown_display_format:
|
||
|
default: users_then_groups
|
||
|
always_add_issue_author_to_assignable_users:
|
||
|
default: 0
|
||
|
default_issue_start_date_to_creation_date:
|
||
|
default: 0
|
||
|
default_issue_due_date_offset:
|
||
| db/migrate/20090318181151_extend_settings_name.rb | ||
|---|---|---|
|
def self.up
|
||
|
change_column :settings, :name, :string, :limit => 255, :default => '', :null => false
|
||
|
# This setting is a default setting for new installations. It should be
|
||
|
# These settings are default settings for new installations. They should be
|
||
|
# inserted in 017_create_settings.rb with the other default settings, but
|
||
|
# its name exceeds the original 30-character limit of the settings.name
|
||
|
# their names exceed the original 30-character limit of the settings.name
|
||
|
# column.
|
||
|
Setting.create!(
|
||
|
:name => 'default_issue_start_date_to_creation_date',
|
||
|
:value => Setting.default_issue_start_date_to_creation_date
|
||
|
)
|
||
|
Setting.create!(
|
||
|
:name => 'always_add_issue_author_to_assignable_users',
|
||
|
:value => Setting.always_add_issue_author_to_assignable_users
|
||
|
)
|
||
|
end
|
||
|
def self.down
|
||
| db/migrate/20260817090000_ensure_always_add_issue_author_to_assignable_users_is_stored_in_db.rb | ||
|---|---|---|
|
class EnsureAlwaysAddIssueAuthorToAssignableUsersIsStoredInDb < ActiveRecord::Migration[8.1]
|
||
|
def up
|
||
|
# Preserve the previous behavior of existing installations, where the issue
|
||
|
# author was always included in the assignee list.
|
||
|
Setting.find_or_create_by!(name: 'always_add_issue_author_to_assignable_users') do |setting|
|
||
|
setting.value = '1'
|
||
|
end
|
||
|
end
|
||
|
def down
|
||
|
# no-op
|
||
|
end
|
||
|
end
|
||
| test/functional/versions_controller_test.rb | ||
|---|---|---|
|
def test_index_should_show_issue_assignee
|
||
|
with_settings :gravatar_enabled => '1' do
|
||
|
Issue.generate!(:project_id => 3, :fixed_version_id => 4, :assigned_to => User.find_by_login('jsmith'))
|
||
|
assignee = User.find_by_login('jsmith')
|
||
|
User.add_to_project(assignee, Project.find(3), Role.find(1))
|
||
|
Issue.generate!(:project_id => 3, :fixed_version_id => 4, :assigned_to => assignee)
|
||
|
Issue.generate!(:project_id => 3, :fixed_version_id => 4)
|
||
|
get :index, :params => {:project_id => 3}
|
||
| test/unit/issue_test.rb | ||
|---|---|---|
|
assert_kind_of User, Issue.find(1).assignable_users.first
|
||
|
end
|
||
|
test "#assignable_users should include the issue author" do
|
||
|
test "#assignable_users should include the issue author when enabled by settings" do
|
||
|
non_project_member = User.generate!
|
||
|
issue = Issue.generate!(:author => non_project_member)
|
||
|
assert issue.assignable_users.include?(non_project_member)
|
||
|
with_settings :always_add_issue_author_to_assignable_users => '1' do
|
||
|
assert issue.assignable_users.include?(non_project_member)
|
||
|
end
|
||
|
end
|
||
|
test "#assignable_users should not include non member author" do
|
||
|
non_project_member = User.generate!
|
||
|
issue = Issue.generate!(:author => non_project_member)
|
||
|
assert_not_include non_project_member, issue.assignable_users
|
||
|
end
|
||
|
def test_assignable_users_should_not_include_anonymous_user
|
||
|
issue = Issue.generate!(:author => User.anonymous)
|
||
|
assert !issue.assignable_users.include?(User.anonymous)
|
||
|
with_settings :always_add_issue_author_to_assignable_users => '1' do
|
||
|
assert !issue.assignable_users.include?(User.anonymous)
|
||
|
end
|
||
|
end
|
||
|
def test_assignable_users_should_not_include_locked_user
|
||
| ... | ... | |
|
issue = Issue.generate!(:author => user)
|
||
|
user.lock!
|
||
|
assert !issue.assignable_users.include?(user)
|
||
|
with_settings :always_add_issue_author_to_assignable_users => '1' do
|
||
|
assert !issue.assignable_users.include?(user)
|
||
|
end
|
||
|
end
|
||
|
def test_assignable_users_should_include_the_current_assignee
|
||
| ... | ... | |
|
end
|
||
|
test "#assignable_users should not show the issue author twice" do
|
||
|
assignable_user_ids = Issue.find(1).assignable_users.collect(&:id)
|
||
|
assert_equal 2, assignable_user_ids.length
|
||
|
with_settings :always_add_issue_author_to_assignable_users => '1' do
|
||
|
assignable_user_ids = Issue.find(1).assignable_users.collect(&:id)
|
||
|
assert_equal 2, assignable_user_ids.length
|
||
|
assignable_user_ids.each do |user_id|
|
||
|
assert_equal 1, assignable_user_ids.count {|i| i == user_id},
|
||
|
"User #{user_id} appears more or less than once"
|
||
|
assignable_user_ids.each do |user_id|
|
||
|
assert_equal 1, assignable_user_ids.count {|i| i == user_id},
|
||
|
"User #{user_id} appears more or less than once"
|
||
|
end
|
||
|
end
|
||
|
end
|
||
| test/unit/query_test.rb | ||
|---|---|---|
|
@issue1 = Issue.generate!(:project => @project, :assigned_to_id => @manager.id)
|
||
|
@issue2 = Issue.generate!(:project => @project, :assigned_to_id => @developer.id)
|
||
|
@issue3 = Issue.generate!(:project => @project, :assigned_to_id => @boss.id)
|
||
|
@issue4 = Issue.generate!(:project => @project, :author_id => @guest.id, :assigned_to_id => @guest.id)
|
||
|
@issue4 =
|
||
|
with_settings :always_add_issue_author_to_assignable_users => '1' do
|
||
|
Issue.generate!(:project => @project, :author_id => @guest.id, :assigned_to_id => @guest.id)
|
||
|
end
|
||
|
@issue5 = Issue.generate!(:project => @project)
|
||
|
@query = IssueQuery.new(:name => '_', :project => @project)
|
||
- « Previous
- 1
- 2
- 3
- Next »