Feature #43997 » 0001-Add-setting-to-always-include-issue-authors-in-assig.patch
| app/models/issue.rb | ||
|---|---|---|
| 1030 | 1030 |
return [] if project.nil? |
| 1031 | 1031 | |
| 1032 | 1032 |
users = project.assignable_users(tracker).to_a |
| 1033 |
users << author if author && author.active? |
|
| 1033 |
if Setting.always_add_issue_author_to_assignable_users? && author&.active? |
|
| 1034 |
users << author |
|
| 1035 |
end |
|
| 1034 | 1036 |
if assigned_to_id_was.present? && assignee = Principal.find_by_id(assigned_to_id_was) |
| 1035 | 1037 |
users << assignee |
| 1036 | 1038 |
end |
| app/views/settings/_issues.html.erb | ||
|---|---|---|
| 15 | 15 | |
| 16 | 16 |
<p><%= setting_select :assignee_dropdown_display_format, assignee_dropdown_display_format_options %></p> |
| 17 | 17 | |
| 18 |
<p><%= setting_check_box :always_add_issue_author_to_assignable_users %></p> |
|
| 19 | ||
| 18 | 20 |
<p><%= setting_check_box :default_issue_start_date_to_creation_date %></p> |
| 19 | 21 | |
| 20 | 22 |
<% |
| config/locales/en.yml | ||
|---|---|---|
| 501 | 501 |
setting_gantt_months_limit: Maximum number of months displayed on the gantt chart |
| 502 | 502 |
setting_issue_group_assignment: Allow issue assignment to groups |
| 503 | 503 |
setting_assignee_dropdown_display_format: Assignee drop-down display format |
| 504 |
setting_always_add_issue_author_to_assignable_users: Always allow issue assignment to the author |
|
| 504 | 505 |
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues |
| 505 | 506 |
setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed |
| 506 | 507 |
setting_unsubscribe: Allow users to delete their own account |
| config/settings.yml | ||
|---|---|---|
| 198 | 198 |
default: 0 |
| 199 | 199 |
assignee_dropdown_display_format: |
| 200 | 200 |
default: users_then_groups |
| 201 |
always_add_issue_author_to_assignable_users: |
|
| 202 |
default: 0 |
|
| 201 | 203 |
default_issue_start_date_to_creation_date: |
| 202 | 204 |
default: 0 |
| 203 | 205 |
default_issue_due_date_offset: |
| db/migrate/20090318181151_extend_settings_name.rb | ||
|---|---|---|
| 2 | 2 |
def self.up |
| 3 | 3 |
change_column :settings, :name, :string, :limit => 255, :default => '', :null => false |
| 4 | 4 | |
| 5 |
# This setting is a default setting for new installations. It should be
|
|
| 5 |
# These settings are default settings for new installations. They should be
|
|
| 6 | 6 |
# inserted in 017_create_settings.rb with the other default settings, but |
| 7 |
# its name exceeds the original 30-character limit of the settings.name
|
|
| 7 |
# their names exceed the original 30-character limit of the settings.name
|
|
| 8 | 8 |
# column. |
| 9 | 9 |
Setting.create!( |
| 10 | 10 |
:name => 'default_issue_start_date_to_creation_date', |
| 11 | 11 |
:value => Setting.default_issue_start_date_to_creation_date |
| 12 | 12 |
) |
| 13 |
Setting.create!( |
|
| 14 |
:name => 'always_add_issue_author_to_assignable_users', |
|
| 15 |
:value => Setting.always_add_issue_author_to_assignable_users |
|
| 16 |
) |
|
| 13 | 17 |
end |
| 14 | 18 | |
| 15 | 19 |
def self.down |
| db/migrate/20260817090000_ensure_always_add_issue_author_to_assignable_users_is_stored_in_db.rb | ||
|---|---|---|
| 1 |
class EnsureAlwaysAddIssueAuthorToAssignableUsersIsStoredInDb < ActiveRecord::Migration[8.1] |
|
| 2 |
def up |
|
| 3 |
# Preserve the previous behavior of existing installations, where the issue |
|
| 4 |
# author was always included in the assignee list. |
|
| 5 |
Setting.find_or_create_by!(name: 'always_add_issue_author_to_assignable_users') do |setting| |
|
| 6 |
setting.value = '1' |
|
| 7 |
end |
|
| 8 |
end |
|
| 9 | ||
| 10 |
def down |
|
| 11 |
# no-op |
|
| 12 |
end |
|
| 13 |
end |
|
| test/functional/versions_controller_test.rb | ||
|---|---|---|
| 100 | 100 | |
| 101 | 101 |
def test_index_should_show_issue_assignee |
| 102 | 102 |
with_settings :gravatar_enabled => '1' do |
| 103 |
Issue.generate!(:project_id => 3, :fixed_version_id => 4, :assigned_to => User.find_by_login('jsmith'))
|
|
| 103 |
assignee = User.find_by_login('jsmith')
|
|
| 104 |
User.add_to_project(assignee, Project.find(3), Role.find(1)) |
|
| 105 |
Issue.generate!(:project_id => 3, :fixed_version_id => 4, :assigned_to => assignee) |
|
| 104 | 106 |
Issue.generate!(:project_id => 3, :fixed_version_id => 4) |
| 105 | 107 | |
| 106 | 108 |
get :index, :params => {:project_id => 3}
|
| test/unit/issue_test.rb | ||
|---|---|---|
| 2696 | 2696 |
assert_kind_of User, Issue.find(1).assignable_users.first |
| 2697 | 2697 |
end |
| 2698 | 2698 | |
| 2699 |
test "#assignable_users should include the issue author" do |
|
| 2699 |
test "#assignable_users should include the issue author when enabled by settings" do
|
|
| 2700 | 2700 |
non_project_member = User.generate! |
| 2701 | 2701 |
issue = Issue.generate!(:author => non_project_member) |
| 2702 | 2702 | |
| 2703 |
assert issue.assignable_users.include?(non_project_member) |
|
| 2703 |
with_settings :always_add_issue_author_to_assignable_users => '1' do |
|
| 2704 |
assert issue.assignable_users.include?(non_project_member) |
|
| 2705 |
end |
|
| 2706 |
end |
|
| 2707 | ||
| 2708 |
test "#assignable_users should not include non member author" do |
|
| 2709 |
non_project_member = User.generate! |
|
| 2710 |
issue = Issue.generate!(:author => non_project_member) |
|
| 2711 | ||
| 2712 |
assert_not_include non_project_member, issue.assignable_users |
|
| 2704 | 2713 |
end |
| 2705 | 2714 | |
| 2706 | 2715 |
def test_assignable_users_should_not_include_anonymous_user |
| 2707 | 2716 |
issue = Issue.generate!(:author => User.anonymous) |
| 2708 | 2717 | |
| 2709 |
assert !issue.assignable_users.include?(User.anonymous) |
|
| 2718 |
with_settings :always_add_issue_author_to_assignable_users => '1' do |
|
| 2719 |
assert !issue.assignable_users.include?(User.anonymous) |
|
| 2720 |
end |
|
| 2710 | 2721 |
end |
| 2711 | 2722 | |
| 2712 | 2723 |
def test_assignable_users_should_not_include_locked_user |
| ... | ... | |
| 2714 | 2725 |
issue = Issue.generate!(:author => user) |
| 2715 | 2726 |
user.lock! |
| 2716 | 2727 | |
| 2717 |
assert !issue.assignable_users.include?(user) |
|
| 2728 |
with_settings :always_add_issue_author_to_assignable_users => '1' do |
|
| 2729 |
assert !issue.assignable_users.include?(user) |
|
| 2730 |
end |
|
| 2718 | 2731 |
end |
| 2719 | 2732 | |
| 2720 | 2733 |
def test_assignable_users_should_include_the_current_assignee |
| ... | ... | |
| 2727 | 2740 |
end |
| 2728 | 2741 | |
| 2729 | 2742 |
test "#assignable_users should not show the issue author twice" do |
| 2730 |
assignable_user_ids = Issue.find(1).assignable_users.collect(&:id) |
|
| 2731 |
assert_equal 2, assignable_user_ids.length |
|
| 2743 |
with_settings :always_add_issue_author_to_assignable_users => '1' do |
|
| 2744 |
assignable_user_ids = Issue.find(1).assignable_users.collect(&:id) |
|
| 2745 |
assert_equal 2, assignable_user_ids.length |
|
| 2732 | 2746 | |
| 2733 |
assignable_user_ids.each do |user_id| |
|
| 2734 |
assert_equal 1, assignable_user_ids.count {|i| i == user_id},
|
|
| 2735 |
"User #{user_id} appears more or less than once"
|
|
| 2747 |
assignable_user_ids.each do |user_id| |
|
| 2748 |
assert_equal 1, assignable_user_ids.count {|i| i == user_id},
|
|
| 2749 |
"User #{user_id} appears more or less than once"
|
|
| 2750 |
end |
|
| 2736 | 2751 |
end |
| 2737 | 2752 |
end |
| 2738 | 2753 | |
| test/unit/query_test.rb | ||
|---|---|---|
| 3015 | 3015 |
@issue1 = Issue.generate!(:project => @project, :assigned_to_id => @manager.id) |
| 3016 | 3016 |
@issue2 = Issue.generate!(:project => @project, :assigned_to_id => @developer.id) |
| 3017 | 3017 |
@issue3 = Issue.generate!(:project => @project, :assigned_to_id => @boss.id) |
| 3018 |
@issue4 = Issue.generate!(:project => @project, :author_id => @guest.id, :assigned_to_id => @guest.id) |
|
| 3018 |
@issue4 = |
|
| 3019 |
with_settings :always_add_issue_author_to_assignable_users => '1' do |
|
| 3020 |
Issue.generate!(:project => @project, :author_id => @guest.id, :assigned_to_id => @guest.id) |
|
| 3021 |
end |
|
| 3019 | 3022 |
@issue5 = Issue.generate!(:project => @project) |
| 3020 | 3023 | |
| 3021 | 3024 |
@query = IssueQuery.new(:name => '_', :project => @project) |
- « Previous
- 1
- 2
- 3
- Next »