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 |
query.filters = {filter_name => {:operator => '~', :values => ['Notes']}}
|
|
820 |
assert_equal [1, 2, 3], find_issues_with_query(query).map(&:id).sort
|
|
821 |
|
|
822 |
query.filters = {filter_name => {:operator => '!~', :values => ['Notes']}}
|
|
823 |
assert_equal (Issue.ids.sort - [1, 2, 3]), find_issues_with_query(query).map(&:id).sort
|
|
824 |
end
|
|
825 |
|
|
826 |
def test_filter_notes_should_ignore_private_notes_that_are_not_visible
|
|
827 |
user = User.generate!
|
|
828 |
Journal.create!(:user_id => user.id, :journalized => Issue.find(2), :notes => 'Notes', :private_notes => true)
|
|
829 |
Journal.create!(:user_id => user.id, :journalized => Issue.find(3), :notes => 'Notes')
|
|
830 |
|
|
831 |
issue_journals = Issue.find(1).journals.sort
|
|
832 |
assert_equal ['Journal notes', 'Some notes with Redmine links: #2, r2.'], issue_journals.map(&:notes)
|
|
833 |
assert_equal [false, false], issue_journals.map(&:private_notes)
|
|
834 |
|
|
835 |
query = IssueQuery.new(:name => '_')
|
|
836 |
filter_name = "notes"
|
|
837 |
assert_include filter_name, query.available_filters.keys
|
|
838 |
|
|
839 |
query.filters = {filter_name => {:operator => '~', :values => ['Notes']}}
|
|
840 |
assert_equal [1, 3], find_issues_with_query(query).map(&:id).sort
|
|
841 |
end
|
|
842 |
|
806 |
843 |
def test_filter_updated_by
|
807 |
844 |
user = User.generate!
|
808 |
845 |
Journal.create!(:user_id => user.id, :journalized => Issue.find(2), :notes => 'Notes')
|