803 |
803 |
end
|
804 |
804 |
end
|
805 |
805 |
|
|
806 |
def test_filter_notes
|
|
807 |
user = User.generate!
|
|
808 |
Journal.create!(:user_id => user.id, :journalized => Issue.find(2), :notes => 'Notes.')
|
|
809 |
Journal.create!(:user_id => user.id, :journalized => Issue.find(3), :notes => 'Notes.')
|
|
810 |
|
|
811 |
issue_journals = Issue.find(1).journals.sort
|
|
812 |
assert_equal ['Journal notes', 'Some notes with Redmine links: #2, r2.'], issue_journals.map(&:notes)
|
|
813 |
assert_equal [false, false], issue_journals.map(&:private_notes)
|
|
814 |
|
|
815 |
query = IssueQuery.new(:name => '_')
|
|
816 |
filter_name = 'notes'
|
|
817 |
assert_include filter_name, query.available_filters.keys
|
|
818 |
|
|
819 |
{
|
|
820 |
'~' => [1, 2, 3],
|
|
821 |
'!~' => Issue.ids.sort - [1, 2, 3],
|
|
822 |
'^' => [2, 3],
|
|
823 |
'$' => [1],
|
|
824 |
}.each do |operator, expected|
|
|
825 |
query.filters = {filter_name => {:operator => operator, :values => ['Notes']}}
|
|
826 |
assert_equal expected, find_issues_with_query(query).map(&:id).sort
|
|
827 |
end
|
|
828 |
end
|
|
829 |
|
|
830 |
def test_filter_notes_should_ignore_private_notes_that_are_not_visible
|
|
831 |
user = User.generate!
|
|
832 |
Journal.create!(:user_id => user.id, :journalized => Issue.find(2), :notes => 'Notes.', :private_notes => true)
|
|
833 |
Journal.create!(:user_id => user.id, :journalized => Issue.find(3), :notes => 'Notes.')
|
|
834 |
|
|
835 |
issue_journals = Issue.find(1).journals.sort
|
|
836 |
assert_equal ['Journal notes', 'Some notes with Redmine links: #2, r2.'], issue_journals.map(&:notes)
|
|
837 |
assert_equal [false, false], issue_journals.map(&:private_notes)
|
|
838 |
|
|
839 |
query = IssueQuery.new(:name => '_')
|
|
840 |
filter_name = 'notes'
|
|
841 |
assert_include filter_name, query.available_filters.keys
|
|
842 |
|
|
843 |
query.filters = {filter_name => {:operator => '~', :values => ['Notes']}}
|
|
844 |
assert_equal [1, 3], find_issues_with_query(query).map(&:id).sort
|
|
845 |
end
|
|
846 |
|
806 |
847 |
def test_filter_updated_by
|
807 |
848 |
user = User.generate!
|
808 |
849 |
Journal.create!(:user_id => user.id, :journalized => Issue.find(2), :notes => 'Notes')
|