diff --git a/app/helpers/queries_helper.rb b/app/helpers/queries_helper.rb
old mode 100644
new mode 100755
index 5c4ad24..4644cff
--- a/app/helpers/queries_helper.rb
+++ b/app/helpers/queries_helper.rb
@@ -183,6 +183,8 @@ module QueriesHelper
value ? (value.visible? ? link_to_issue(value, :subject => false) : "##{value.id}") : ''
when :description
item.description? ? content_tag('div', textilizable(item, :description), :class => "wiki") : ''
+ when :last_notes
+ item.last_notes.present? ? content_tag('div', textilizable(item, :last_notes), :class => "wiki") : ''
when :done_ratio
progress_bar(value)
when :relations
diff --git a/app/models/issue.rb b/app/models/issue.rb
old mode 100644
new mode 100755
index 65d0784..b06467c
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -244,6 +244,7 @@ class Issue < ActiveRecord::Base
@spent_hours = nil
@total_spent_hours = nil
@total_estimated_hours = nil
+ @last_notes = nil
base_reload(*args)
end
@@ -1048,6 +1049,16 @@ class Issue < ActiveRecord::Base
@relations ||= IssueRelation::Relations.new(self, (relations_from + relations_to).sort)
end
+ def last_notes
+ if @last_notes
+ @last_notes
+ else
+ notes = self.journals.where.not(notes: '').to_a
+ notes.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, self.project)
+ notes.last.notes unless notes.empty?
+ end
+ end
+
# Preloads relations for a collection of issues
def self.load_relations(issues)
if issues.any?
@@ -1102,6 +1113,22 @@ class Issue < ActiveRecord::Base
end
end
+ # Preloads visible last notes for a collection of issues
+ def self.load_visible_last_notes(issues, user=User.current)
+ if issues.any?
+ issue_ids = issues.map(&:id)
+
+ notes = Journal.joins(issue: :project).where.not(notes: '').
+ where(:issues => {:id => issue_ids}).order("#{Journal.table_name}.id ASC").to_a
+
+ issues.each do |issue|
+ note = notes.select{|note| note.journalized_id == issue.id}
+ note.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, issue.project)
+ issue.instance_variable_set "@last_notes", (note.empty? ? '' : note.last.notes)
+ end
+ end
+ end
+
# Finds an issue relation given its id.
def find_relation(relation_id)
IssueRelation.where("issue_to_id = ? OR issue_from_id = ?", id, id).find(relation_id)
diff --git a/app/models/issue_query.rb b/app/models/issue_query.rb
old mode 100644
new mode 100755
index 137764e..81ede65
--- a/app/models/issue_query.rb
+++ b/app/models/issue_query.rb
@@ -44,7 +44,8 @@ class IssueQuery < Query
QueryColumn.new(:created_on, :sortable => "#{Issue.table_name}.created_on", :default_order => 'desc'),
QueryColumn.new(:closed_on, :sortable => "#{Issue.table_name}.closed_on", :default_order => 'desc'),
QueryColumn.new(:relations, :caption => :label_related_issues),
- QueryColumn.new(:description, :inline => false)
+ QueryColumn.new(:description, :inline => false),
+ QueryColumn.new(:last_notes, :caption => :label_last_notes, :inline => false)
]
def initialize(attributes=nil, *args)
@@ -330,6 +331,9 @@ class IssueQuery < Query
if has_column?(:relations)
Issue.load_visible_relations(issues)
end
+ if has_column?(:last_notes)
+ Issue.load_visible_last_notes(issues)
+ end
issues
rescue ::ActiveRecord::StatementInvalid => e
raise StatementInvalid.new(e.message)
diff --git a/app/views/issues/_list.html.erb b/app/views/issues/_list.html.erb
old mode 100644
new mode 100755
index 851fca1..1cb3a88
--- a/app/views/issues/_list.html.erb
+++ b/app/views/issues/_list.html.erb
@@ -33,7 +33,12 @@
<% @query.block_columns.each do |column|
if (text = column_content(column, issue)) && text.present? -%>
- <%= text %> |
+
+ <% if query.block_columns.count > 1 %>
+ <%= column.caption %>
+ <% end %>
+ <%= text %>
+ |
<% end -%>
<% end -%>
diff --git a/app/views/issues/index.html.erb b/app/views/issues/index.html.erb
old mode 100644
new mode 100755
index a9f321c..e851d4e
--- a/app/views/issues/index.html.erb
+++ b/app/views/issues/index.html.erb
@@ -37,6 +37,7 @@
+
<% if @issue_count > Setting.issues_export_limit.to_i %>
diff --git a/app/views/timelog/_list.html.erb b/app/views/timelog/_list.html.erb
old mode 100644
new mode 100755
index 3721df2..a03039b
--- a/app/views/timelog/_list.html.erb
+++ b/app/views/timelog/_list.html.erb
@@ -50,7 +50,12 @@
<% @query.block_columns.each do |column|
if (text = column_content(column, issue)) && text.present? -%>
- <%= text %> |
+
+ <% if query.block_columns.count > 1 %>
+ <%= column.caption %>
+ <% end %>
+ <%= text %>
+ |
<% end -%>
<% end -%>
diff --git a/config/locales/en.yml b/config/locales/en.yml
old mode 100644
new mode 100755
index b5f771d..b31d678
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -1009,6 +1009,7 @@ en:
label_font_default: Default font
label_font_monospace: Monospaced font
label_font_proportional: Proportional font
+ label_last_notes: Last notes
button_login: Login
button_submit: Submit
diff --git a/lib/redmine/export/pdf/issues_pdf_helper.rb b/lib/redmine/export/pdf/issues_pdf_helper.rb
old mode 100644
new mode 100755
index 75f63d2..c5fffa8
--- a/lib/redmine/export/pdf/issues_pdf_helper.rb
+++ b/lib/redmine/export/pdf/issues_pdf_helper.rb
@@ -45,21 +45,21 @@ module Redmine
pdf.SetFontStyle('',8)
pdf.RDMMultiCell(190, 5, "#{format_time(issue.created_on)} - #{issue.author}")
pdf.ln
-
+
left = []
left << [l(:field_status), issue.status]
left << [l(:field_priority), issue.priority]
left << [l(:field_assigned_to), issue.assigned_to] unless issue.disabled_core_fields.include?('assigned_to_id')
left << [l(:field_category), issue.category] unless issue.disabled_core_fields.include?('category_id')
left << [l(:field_fixed_version), issue.fixed_version] unless issue.disabled_core_fields.include?('fixed_version_id')
-
+
right = []
right << [l(:field_start_date), format_date(issue.start_date)] unless issue.disabled_core_fields.include?('start_date')
right << [l(:field_due_date), format_date(issue.due_date)] unless issue.disabled_core_fields.include?('due_date')
right << [l(:field_done_ratio), "#{issue.done_ratio}%"] unless issue.disabled_core_fields.include?('done_ratio')
right << [l(:field_estimated_hours), l_hours(issue.estimated_hours)] unless issue.disabled_core_fields.include?('estimated_hours')
right << [l(:label_spent_time), l_hours(issue.total_spent_hours)] if User.current.allowed_to?(:view_time_entries, issue.project)
-
+
rows = left.size > right.size ? left.size : right.size
while left.size < rows
left << nil
@@ -67,12 +67,12 @@ module Redmine
while right.size < rows
right << nil
end
-
+
half = (issue.visible_custom_field_values.size / 2.0).ceil
issue.visible_custom_field_values.each_with_index do |custom_value, i|
(i < half ? left : right) << [custom_value.custom_field.name, show_value(custom_value, false)]
end
-
+
if pdf.get_rtl
border_first_top = 'RT'
border_last_top = 'LT'
@@ -84,7 +84,7 @@ module Redmine
border_first = 'L'
border_last = 'R'
end
-
+
rows = left.size > right.size ? left.size : right.size
rows.times do |i|
heights = []
@@ -99,26 +99,26 @@ module Redmine
item = right[i]
heights << pdf.get_string_height(60, item ? item.last.to_s : "")
height = heights.max
-
+
item = left[i]
pdf.SetFontStyle('B',9)
pdf.RDMMultiCell(35, height, item ? "#{item.first}:" : "", (i == 0 ? border_first_top : border_first), '', 0, 0)
pdf.SetFontStyle('',9)
pdf.RDMMultiCell(60, height, item ? item.last.to_s : "", (i == 0 ? border_last_top : border_last), '', 0, 0)
-
+
item = right[i]
pdf.SetFontStyle('B',9)
pdf.RDMMultiCell(35, height, item ? "#{item.first}:" : "", (i == 0 ? border_first_top : border_first), '', 0, 0)
pdf.SetFontStyle('',9)
pdf.RDMMultiCell(60, height, item ? item.last.to_s : "", (i == 0 ? border_last_top : border_last), '', 0, 2)
-
+
pdf.set_x(base_x)
end
-
+
pdf.SetFontStyle('B',9)
pdf.RDMCell(35+155, 5, l(:field_description), "LRT", 1)
pdf.SetFontStyle('',9)
-
+
# Set resize image scale
pdf.set_image_scale(1.6)
text = textilizable(issue, :description,
@@ -128,7 +128,7 @@ module Redmine
:inline_attachments => false
)
pdf.RDMwriteFormattedCell(35+155, 5, '', '', text, issue.attachments, "LRB")
-
+
unless issue.leaf?
truncate_length = (!is_cjk? ? 90 : 65)
pdf.SetFontStyle('B',9)
@@ -145,7 +145,7 @@ module Redmine
pdf.ln
end
end
-
+
relations = issue.relations.select { |r| r.other_issue(issue).visible? }
unless relations.empty?
truncate_length = (!is_cjk? ? 80 : 60)
@@ -173,7 +173,7 @@ module Redmine
end
pdf.RDMCell(190,5, "", "T")
pdf.ln
-
+
if issue.changesets.any? &&
User.current.allowed_to?(:view_changesets, issue.project)
pdf.SetFontStyle('B',9)
@@ -193,7 +193,7 @@ module Redmine
pdf.ln
end
end
-
+
if assoc[:journals].present?
pdf.SetFontStyle('B',9)
pdf.RDMCell(190,5, l(:label_history), "B")
@@ -222,7 +222,7 @@ module Redmine
pdf.ln
end
end
-
+
if issue.attachments.any?
pdf.SetFontStyle('B',9)
pdf.RDMCell(190,5, l(:label_attachment_plural), "B")
@@ -249,7 +249,7 @@ module Redmine
pdf.footer_date = format_date(User.current.today)
pdf.set_auto_page_break(false)
pdf.add_page("L")
-
+
# Landscape A4 = 210 x 297 mm
page_height = pdf.get_page_height # 210
page_width = pdf.get_page_width # 297
@@ -257,7 +257,7 @@ module Redmine
right_margin = pdf.get_original_margins['right'] # 10
bottom_margin = pdf.get_footer_margin
row_height = 4
-
+
# column widths
table_width = page_width - right_margin - left_margin
col_width = []
@@ -265,13 +265,13 @@ module Redmine
col_width = calc_col_width(issues, query, table_width, pdf)
table_width = col_width.inject(0, :+)
end
-
- # use full width if the description is displayed
- if table_width > 0 && query.has_column?(:description)
+
+ # use full width if the description or last_notes are displayed
+ if table_width > 0 && (query.has_column?(:description) || query.has_column?(:last_notes))
col_width = col_width.map {|w| w * (page_width - right_margin - left_margin) / table_width}
table_width = col_width.inject(0, :+)
end
-
+
# title
pdf.SetFontStyle('B',11)
pdf.RDMCell(190, 8, title)
@@ -303,10 +303,10 @@ module Redmine
end
previous_group = group
end
-
+
# fetch row values
col_values = fetch_row_values(issue, query, level)
-
+
# make new page if it doesn't fit on the current one
base_y = pdf.get_y
max_height = get_issues_to_pdf_write_cells(pdf, col_values, col_width)
@@ -316,19 +316,26 @@ module Redmine
render_table_header(pdf, query, col_width, row_height, table_width)
base_y = pdf.get_y
end
-
+
# write the cells on page
issues_to_pdf_write_cells(pdf, col_values, col_width, max_height)
pdf.set_y(base_y + max_height)
-
+
if query.has_column?(:description) && issue.description?
pdf.set_x(10)
pdf.set_auto_page_break(true, bottom_margin)
pdf.RDMwriteHTMLCell(0, 5, 10, '', issue.description.to_s, issue.attachments, "LRBT")
pdf.set_auto_page_break(false)
end
+
+ if query.has_column?(:last_notes) && issue.last_notes.present?
+ pdf.set_x(10)
+ pdf.set_auto_page_break(true, bottom_margin)
+ pdf.RDMwriteHTMLCell(0, 5, 10, '', issue.last_notes.to_s, [], "LRBT")
+ pdf.set_auto_page_break(false)
+ end
end
-
+
if issues.size == Setting.issues_export_limit.to_i
pdf.SetFontStyle('B',10)
pdf.RDMCell(0, row_height, '...')
diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css
old mode 100644
new mode 100755
index 701be55..5d6341e
--- a/public/stylesheets/application.css
+++ b/public/stylesheets/application.css
@@ -255,8 +255,8 @@ tr.issue td.subject, tr.issue td.category, td.assigned_to, tr.issue td.string, t
tr.issue td.relations { text-align: left; }
tr.issue td.done_ratio table.progress { margin-left:auto; margin-right: auto;}
tr.issue td.relations span {white-space: nowrap;}
-table.issues td.description {color:#777; font-size:90%; padding:4px 4px 4px 24px; text-align:left; white-space:normal;}
-table.issues td.description pre {white-space:normal;}
+table.issues td.description, table.issues td.last_notes {color:#777; font-size:90%; padding:4px 4px 4px 24px; text-align:left; white-space:normal;}
+table.issues td.description pre, table.issues td.last_notes pre {white-space:normal;}
tr.issue.idnt td.subject {background: url(../images/bullet_arrow_right.png) no-repeat 0 50%;}
tr.issue.idnt-1 td.subject {padding-left: 24px; background-position: 8px 50%;}
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
old mode 100644
new mode 100755
index 3e1bfa2..5570b2e
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -561,8 +561,8 @@ class IssuesControllerTest < Redmine::ControllerTest
str_big5 = "\xa4@\xa4\xeb".force_encoding('Big5')
issue = Issue.generate!(:subject => str_utf8)
- get :index, :project_id => 1,
- :f => ['subject'],
+ get :index, :project_id => 1,
+ :f => ['subject'],
:op => '=', :values => [str_utf8],
:format => 'csv'
assert_equal 'text/csv; header=present', @response.content_type
@@ -580,8 +580,8 @@ class IssuesControllerTest < Redmine::ControllerTest
str_utf8 = "\xe4\xbb\xa5\xe5\x86\x85".force_encoding('UTF-8')
issue = Issue.generate!(:subject => str_utf8)
- get :index, :project_id => 1,
- :f => ['subject'],
+ get :index, :project_id => 1,
+ :f => ['subject'],
:op => '=', :values => [str_utf8],
:c => ['status', 'subject'],
:format => 'csv',
@@ -603,8 +603,8 @@ class IssuesControllerTest < Redmine::ControllerTest
str1 = "test_index_csv_tw"
issue = Issue.generate!(:subject => str1, :estimated_hours => '1234.5')
- get :index, :project_id => 1,
- :f => ['subject'],
+ get :index, :project_id => 1,
+ :f => ['subject'],
:op => '=', :values => [str1],
:c => ['estimated_hours', 'subject'],
:format => 'csv',
@@ -620,8 +620,8 @@ class IssuesControllerTest < Redmine::ControllerTest
str1 = "test_index_csv_fr"
issue = Issue.generate!(:subject => str1, :estimated_hours => '1234.5')
- get :index, :project_id => 1,
- :f => ['subject'],
+ get :index, :project_id => 1,
+ :f => ['subject'],
:op => '=', :values => [str1],
:c => ['estimated_hours', 'subject'],
:format => 'csv',
@@ -696,34 +696,34 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_response :success
end
end
-
+
def test_index_sort_by_assigned_to
get :index, :sort => 'assigned_to'
assert_response :success
-
+
assignees = issues_in_list.map(&:assigned_to).compact
assert_equal assignees.sort, assignees
assert_select 'table.issues.sort-by-assigned-to.sort-asc'
end
-
+
def test_index_sort_by_assigned_to_desc
get :index, :sort => 'assigned_to:desc'
assert_response :success
-
+
assignees = issues_in_list.map(&:assigned_to).compact
assert_equal assignees.sort.reverse, assignees
assert_select 'table.issues.sort-by-assigned-to.sort-desc'
end
-
+
def test_index_group_by_assigned_to
get :index, :group_by => 'assigned_to', :sort => 'priority'
assert_response :success
end
-
+
def test_index_sort_by_author
get :index, :sort => 'author', :c => ['author']
assert_response :success
-
+
authors = issues_in_list.map(&:author)
assert_equal authors.sort, authors
end
@@ -731,30 +731,30 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_index_sort_by_author_desc
get :index, :sort => 'author:desc'
assert_response :success
-
+
authors = issues_in_list.map(&:author)
assert_equal authors.sort.reverse, authors
end
-
+
def test_index_group_by_author
get :index, :group_by => 'author', :sort => 'priority'
assert_response :success
end
-
+
def test_index_sort_by_spent_hours
get :index, :sort => 'spent_hours:desc'
assert_response :success
hours = issues_in_list.map(&:spent_hours)
assert_equal hours.sort.reverse, hours
end
-
+
def test_index_sort_by_total_spent_hours
get :index, :sort => 'total_spent_hours:desc'
assert_response :success
hours = issues_in_list.map(&:total_spent_hours)
assert_equal hours.sort.reverse, hours
end
-
+
def test_index_sort_by_total_estimated_hours
get :index, :sort => 'total_estimated_hours:desc'
assert_response :success
@@ -959,6 +959,43 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_equal 'application/pdf', response.content_type
end
+ def test_index_with_last_notes_column
+ get :index, :set_filter => 1, :c => %w(subject last_notes)
+
+ assert_response :success
+ assert_select 'table.issues thead th', 3 # columns: chekbox + id + subject
+
+ assert_select 'td.last_notes[colspan="3"]', :text => 'Some notes with Redmine links: #2, r2.'
+ assert_select 'td.last_notes[colspan="3"]', :text => 'A comment with inline image: and a reference to #1 and r2.'
+
+ get :index, :set_filter => 1, :c => %w(subject last_notes), :format => 'pdf'
+ assert_response :success
+ assert_equal 'application/pdf', response.content_type
+ end
+
+ def test_index_with_last_notes_column_should_display_private_notes_with_permission_only
+ journal = Journal.create!(:journalized => Issue.find(2), :notes => 'Privates notes', :private_notes => true, :user_id => 1)
+ @request.session[:user_id] = 2
+
+ get :index, :set_filter => 1, :c => %w(subject last_notes)
+ assert_response :success
+ assert_select 'td.last_notes[colspan="3"]', :text => 'Privates notes'
+
+ Role.find(1).remove_permission! :view_private_notes
+
+ get :index, :set_filter => 1, :c => %w(subject last_notes)
+ assert_response :success
+ assert_select 'td.last_notes[colspan="3"]', :text => 'A comment with inline image: and a reference to #1 and r2.'
+ end
+
+ def test_index_with_description_and_last_notes_columns_should_display_column_name
+ get :index, :set_filter => 1, :c => %w(subject last_notes description)
+ assert_response :success
+
+ assert_select 'td.last_notes[colspan="3"] span', :text => 'Last notes'
+ assert_select 'td.description[colspan="3"] span', :text => 'Description'
+ end
+
def test_index_with_parent_column
Issue.delete_all
parent = Issue.generate!
@@ -1093,7 +1130,7 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_index_should_not_include_new_issue_tab_for_project_without_trackers
with_settings :new_item_menu_tab => '1' do
Project.find(1).trackers.clear
-
+
@request.session[:user_id] = 2
get :index, :project_id => 1
assert_select '#main-menu a.new-issue', 0
@@ -1105,7 +1142,7 @@ class IssuesControllerTest < Redmine::ControllerTest
role = Role.find(1)
role.remove_permission! :add_issues
role.add_permission! :copy_issues
-
+
@request.session[:user_id] = 2
get :index, :project_id => 1
assert_select '#main-menu a.new-issue', 0
@@ -1381,7 +1418,7 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_show_should_display_prev_next_links_with_query_and_sort_on_association
@request.session[:issue_query] = {:filters => {'status_id' => {:values => [''], :operator => 'o'}}, :project_id => nil}
-
+
%w(project tracker status priority author assigned_to category fixed_version).each do |assoc_sort|
@request.session['issues_index_sort'] = assoc_sort
@@ -1614,7 +1651,7 @@ class IssuesControllerTest < Redmine::ControllerTest
end
def test_show_export_to_pdf
- issue = Issue.find(3)
+ issue = Issue.find(3)
assert issue.relations.select{|r| r.other_issue(issue).visible?}.present?
get :show, :id => 3, :format => 'pdf'
assert_response :success
@@ -2062,7 +2099,7 @@ class IssuesControllerTest < Redmine::ControllerTest
get :new, :project_id => 'invalid'
assert_response 404
end
-
+
def test_new_with_parent_id_should_only_propose_valid_trackers
@request.session[:user_id] = 2
t = Tracker.find(3)
@@ -2611,7 +2648,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:custom_field_values => {'2' => 'Value for field 2'}}
end
assert_redirected_to :controller => 'issues', :action => 'show', :id => Issue.last.id
-
+
assert_equal 1, ActionMailer::Base.deliveries.size
end
end
@@ -2885,7 +2922,7 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_select 'option[value="1"][selected=selected]', :text => 'eCookbook'
assert_select 'option[value="2"]:not([selected])', :text => 'OnlineStore'
end
- assert_select 'input[name=?][value=?]', 'issue[subject]', orig.subject
+ assert_select 'input[name=?][value=?]', 'issue[subject]', orig.subject
assert_select 'input[name=copy_from][value="1"]'
end
end
@@ -3180,7 +3217,7 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_get_edit_should_display_the_time_entry_form_with_log_time_permission
@request.session[:user_id] = 2
Role.find_by_name('Manager').update_attribute :permissions, [:view_issues, :edit_issues, :log_time]
-
+
get :edit, :id => 1
assert_select 'input[name=?]', 'time_entry[hours]'
end
@@ -3188,7 +3225,7 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_get_edit_should_not_display_the_time_entry_form_without_log_time_permission
@request.session[:user_id] = 2
Role.find_by_name('Manager').remove_permission! :log_time
-
+
get :edit, :id => 1
assert_select 'input[name=?]', 'time_entry[hours]', 0
end
@@ -3833,7 +3870,7 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_response :redirect
assert_redirected_to :controller => 'issues', :action => 'show', :id => issue.id
end
-
+
def test_put_update_should_redirect_with_previous_and_next_issue_ids_params
@request.session[:user_id] = 2
@@ -3887,17 +3924,17 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_select 'select[name=?]', 'issue[project_id]'
assert_select 'input[name=?]', 'issue[parent_issue_id]'
-
+
# Project specific custom field, date type
field = CustomField.find(9)
assert !field.is_for_all?
assert_equal 'date', field.field_format
assert_select 'input[name=?]', 'issue[custom_field_values][9]'
-
+
# System wide custom field
assert CustomField.find(1).is_for_all?
assert_select 'select[name=?]', 'issue[custom_field_values][1]'
-
+
# Be sure we don't display inactive IssuePriorities
assert ! IssuePriority.find(15).active?
assert_select 'select[name=?]', 'issue[priority_id]' do
@@ -4084,7 +4121,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:issue => {:priority_id => '',
:assigned_to_id => group.id,
:custom_field_values => {'2' => ''}}
-
+
assert_response 302
assert_equal [group, group], Issue.where(:id => [1, 2]).collect {|i| i.assigned_to}
end
@@ -4390,7 +4427,7 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_select 'option[value="2"]'
end
end
-
+
def test_bulk_copy_to_another_project
@request.session[:user_id] = 2
assert_difference 'Issue.count', 2 do
@@ -4443,7 +4480,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:assigned_to_id => 2)
]
assert_difference 'Issue.count', issues.size do
- post :bulk_update, :ids => issues.map(&:id), :copy => '1',
+ post :bulk_update, :ids => issues.map(&:id), :copy => '1',
:issue => {
:project_id => '', :tracker_id => '', :assigned_to_id => '',
:status_id => '', :start_date => '', :due_date => ''
@@ -4475,7 +4512,7 @@ class IssuesControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
assert_difference 'Issue.count', 2 do
assert_no_difference 'Project.find(1).issues.count' do
- post :bulk_update, :ids => [1, 2], :copy => '1',
+ post :bulk_update, :ids => [1, 2], :copy => '1',
:issue => {
:project_id => '2', :tracker_id => '', :assigned_to_id => '2',
:status_id => '1', :start_date => '2009-12-01', :due_date => '2009-12-31'
diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb
old mode 100644
new mode 100755
index 6d27106..7b3ced0
--- a/test/unit/query_test.rb
+++ b/test/unit/query_test.rb
@@ -682,15 +682,15 @@ class QueryTest < ActiveSupport::TestCase
Member.create!(:project_id => 1, :principal => other_group, :role_ids => [1])
User.current = user
- with_settings :issue_group_assignment => '1' do
+ with_settings :issue_group_assignment => '1' do
i1 = Issue.generate!(:project_id => 1, :tracker_id => 1, :assigned_to => user)
i2 = Issue.generate!(:project_id => 1, :tracker_id => 1, :assigned_to => group)
i3 = Issue.generate!(:project_id => 1, :tracker_id => 1, :assigned_to => other_group)
-
+
query = IssueQuery.new(:name => '_', :filters => { 'assigned_to_id' => {:operator => '=', :values => ['me']}})
result = query.issues
assert_equal Issue.visible.where(:assigned_to_id => ([2] + user.reload.group_ids)).sort_by(&:id), result.sort_by(&:id)
-
+
assert result.include?(i1)
assert result.include?(i2)
assert !result.include?(i3)
@@ -1107,10 +1107,10 @@ class QueryTest < ActiveSupport::TestCase
def test_inline_and_block_columns
q = IssueQuery.new
- q.column_names = ['subject', 'description', 'tracker']
+ q.column_names = ['subject', 'description', 'tracker', 'last_notes']
assert_equal [:id, :subject, :tracker], q.inline_columns.map(&:name)
- assert_equal [:description], q.block_columns.map(&:name)
+ assert_equal [:description, :last_notes], q.block_columns.map(&:name)
end
def test_custom_field_columns_should_be_inline
@@ -1127,6 +1127,13 @@ class QueryTest < ActiveSupport::TestCase
assert_not_nil issues.first.instance_variable_get("@spent_hours")
end
+ def test_query_should_preload_last_notes
+ q = IssueQuery.new(:name => '_', :column_names => [:subject, :last_notes])
+ assert q.has_column?(:last_notes)
+ issues = q.issues
+ assert_not_nil issues.first.instance_variable_get("@last_notes")
+ end
+
def test_groupable_columns_should_include_custom_fields
q = IssueQuery.new
column = q.groupable_columns.detect {|c| c.name == :cf_1}