https://www.redmine.org/https://www.redmine.org/favicon.ico?16793021292010-07-18T00:56:50ZRedmineRedmine - Feature #5893: Filter issues by noteshttps://www.redmine.org/issues/5893?journal_id=184082010-07-18T00:56:50ZMischa The Evil
<ul><li><strong>Tracker</strong> changed from <i>Feature</i> to <i>Patch</i></li><li><strong>Category</strong> set to <i>Issues</i></li></ul>Fixed and improved:
<ul>
<li>Tracker</li>
<li>Description</li>
<li>Category</li>
</ul> Redmine - Feature #5893: Filter issues by noteshttps://www.redmine.org/issues/5893?journal_id=273652011-03-30T12:54:10ZSimon RES
<ul><li><strong>File</strong> <a href="/attachments/5717">HOW_TO.txt</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/5717/HOW_TO.txt">HOW_TO.txt</a> added</li></ul><p>Here is a how-to add a public/private field for journals.</p> Redmine - Feature #5893: Filter issues by noteshttps://www.redmine.org/issues/5893?journal_id=340562011-11-23T18:48:46ZCharles Monteiro
<ul></ul><p>We need to filter on description as well</p> Redmine - Feature #5893: Filter issues by noteshttps://www.redmine.org/issues/5893?journal_id=437132013-01-02T13:46:21ZTerence Mill
<ul></ul><p>related to <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: Allow issue description to be searchable as a filter (Closed)" href="https://www.redmine.org/issues/1159">#1159</a></p> Redmine - Feature #5893: Filter issues by noteshttps://www.redmine.org/issues/5893?journal_id=510192013-08-05T22:29:35ZMischa The Evil
<ul><li><strong>Related to</strong> <i><a class="issue tracker-2 status-5 priority-4 priority-default closed" href="/issues/14468">Feature #14468</a>: Search for text in description and comments in issue search and restrict projects.</i> added</li></ul> Redmine - Feature #5893: Filter issues by noteshttps://www.redmine.org/issues/5893?journal_id=734722016-09-13T05:07:00ZToshi MARUYAMA
<ul><li><strong>Related to</strong> <i><a class="issue tracker-2 status-5 priority-4 priority-default closed" href="/issues/680">Feature #680</a>: free text ticket filter</i> added</li></ul> Redmine - Feature #5893: Filter issues by noteshttps://www.redmine.org/issues/5893?journal_id=920182019-05-24T10:24:35ZTomasz O
<ul></ul><p>This patch enables applying filter on notes in Redmine version 3.4.4:<br /><pre>
diff -c app/models/issue_query.rb.orig app/models/issue_query.rb
*** app/models/issue_query.rb.orig 2018-01-08 13:38:16.000000000 -0600
--- app/models/issue_query.rb 2019-05-24 04:41:38.709524653 -0500
***************
*** 136,141 ****
--- 136,143 ----
add_available_filter "estimated_hours", :type => :float
add_available_filter "done_ratio", :type => :integer
+ add_available_filter "notes", :type => :text
+
if User.current.allowed_to?(:set_issues_private, nil, :global => true) ||
User.current.allowed_to?(:set_own_issues_private, nil, :global => true)
add_available_filter "is_private",
***************
*** 359,364 ****
--- 361,376 ----
raise StatementInvalid.new(e.message)
end
+ def sql_for_notes_field(field, operator, value)
+ neg = (operator == '!' ? 'NOT' : '')
+ subquery = "SELECT 1 FROM #{Journal.table_name}" +
+ " WHERE #{Journal.table_name}.journalized_type='Issue' AND #{Journal.table_name}.journalized_id=#{Issue.table_name}.id" +
+ " AND (#{sql_for_field field, operator , value, Journal.table_name, 'notes'})" +
+ " AND (#{Journal.visible_notes_condition(User.current, :skip_pre_condition => true)})"
+
+ "#{neg} EXISTS (#{subquery})"
+ end
+
def sql_for_updated_by_field(field, operator, value)
neg = (operator == '!' ? 'NOT' : '')
subquery = "SELECT 1 FROM #{Journal.table_name}" +
</pre></p>
<p>Maybe someone else will find them usefull.</p> Redmine - Feature #5893: Filter issues by noteshttps://www.redmine.org/issues/5893?journal_id=951012019-12-02T09:39:21ZAlexander Achenbach
<ul><li><strong>File</strong> <a href="/attachments/24400">filter-by-notes.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/24400/filter-by-notes.patch">filter-by-notes.patch</a> added</li></ul><p>As a follow-up to <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: Filter issues by notes (Closed)" href="https://www.redmine.org/issues/5893#note-7">#5893#note-7</a>, here's a revised patch of the notes query against Redmine 4.0.5.<br />It fixes logic problems in operator handling that were in the original patch.</p> Redmine - Feature #5893: Filter issues by noteshttps://www.redmine.org/issues/5893?journal_id=953292019-12-14T23:58:07ZGo MAEDA
<ul><li><strong>Category</strong> changed from <i>Issues</i> to <i>Issues filter</i></li></ul> Redmine - Feature #5893: Filter issues by noteshttps://www.redmine.org/issues/5893?journal_id=1012442021-03-09T00:44:44ZYuichi HARADA
<ul><li><strong>File</strong> <a href="/attachments/26766">filter-by-notes-with-tests.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/26766/filter-by-notes-with-tests.patch">filter-by-notes-with-tests.patch</a> added</li></ul><p>Alexander Achenbach wrote:</p>
<blockquote>
<p>As a follow-up to <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: Filter issues by notes (Closed)" href="https://www.redmine.org/issues/5893#note-7">#5893#note-7</a>, here's a revised patch of the notes query against Redmine 4.0.5.<br />It fixes logic problems in operator handling that were in the original patch.</p>
</blockquote>
<p>Thank you for creating the patch.<br />I adjusted filter-by-notes.patch to work with Redmine-trunk (<a class="changeset" title="Project settings tab contains two items with the same id (#34032). Patch by Ali Hamdan and Mariu..." href="https://www.redmine.org/projects/redmine/repository/svn/revisions/20766">r20766</a>) and added tests.</p> Redmine - Feature #5893: Filter issues by noteshttps://www.redmine.org/issues/5893?journal_id=1012562021-03-09T09:31:36ZGo MAEDA
<ul><li><strong>File</strong> <a href="/attachments/26768">filter-by-notes-with-tests-v2.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/26768/filter-by-notes-with-tests-v2.patch">filter-by-notes-with-tests-v2.patch</a> added</li><li><strong>Target version</strong> set to <i>Candidate for next major release</i></li></ul><p>This is a feature I have wanted for years. Thank you for updating the patch and adding the test.</p>
<p>I have changed the patch to move the "notes" position in the filters dropdown to below the "description".</p> Redmine - Feature #5893: Filter issues by noteshttps://www.redmine.org/issues/5893?journal_id=1012832021-03-11T05:08:21ZGo MAEDA
<ul><li><strong>Target version</strong> changed from <i>Candidate for next major release</i> to <i>4.2.0</i></li></ul><p>Setting the target version to 4.2.0.</p> Redmine - Feature #5893: Filter issues by noteshttps://www.redmine.org/issues/5893?journal_id=1013092021-03-13T02:14:13ZGo MAEDA
<ul><li><strong>File</strong> <a href="/attachments/26798">start-with-does-not-work.png</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/26798/start-with-does-not-work.png">start-with-does-not-work.png</a> added</li><li><strong>Target version</strong> changed from <i>4.2.0</i> to <i>Candidate for next major release</i></li></ul><p>The patch needs to be fixed.</p>
<p>"starts with" and "ends with" operators for notes don't work as expected. They behave like "any" operator. This means that even if you give a nonexistent string to those operators, the issues list displays issues that have any notes.</p>
<p><img src="https://www.redmine.org/attachments/download/26798/start-with-does-not-work.png" style="width: 539px;border: 1px solid grey;" alt="" /></p>
<p>My environment:<br /><pre>
Environment:
Redmine version 4.1.1.devel
Ruby version 2.7.2-p137 (2020-10-01) [x86_64-darwin19]
Rails version 5.2.4.4
Environment development
Database adapter SQLite
Mailer queue ActiveJob::QueueAdapters::InlineAdapter
Mailer delivery smtp
</pre></p> Redmine - Feature #5893: Filter issues by noteshttps://www.redmine.org/issues/5893?journal_id=1013242021-03-15T04:43:27ZYuichi HARADA
<ul><li><strong>File</strong> <a href="/attachments/26810">filter-by-notes-with-tests-v3.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/26810/filter-by-notes-with-tests-v3.patch">filter-by-notes-with-tests-v3.patch</a> added</li></ul><p>Go MAEDA wrote:</p>
<blockquote>
<p>"starts with" and "ends with" operators for notes don't work as expected. They behave like "any" operator. This means that even if you give a nonexistent string to those operators, the issues list displays issues that have any notes.</p>
</blockquote>
<p>I've confirmed. I fixed the patch as follows.</p>
<pre><code class="diff syntaxhl"><span class="gh">diff --git a/app/models/issue_query.rb b/app/models/issue_query.rb
index deb06dc82..4848fcb2d 100644
</span><span class="gd">--- a/app/models/issue_query.rb
</span><span class="gi">+++ b/app/models/issue_query.rb
</span><span class="p">@@ -451,9 +451,9 @@</span> class IssueQuery < Query
def sql_for_notes_field(field, operator, value)
subquery = "SELECT 1 FROM #{Journal.table_name}" +
" WHERE #{Journal.table_name}.journalized_type='Issue' AND #{Journal.table_name}.journalized_id=#{Issue.table_name}.id" +
<span class="gd">- " AND (#{sql_for_field field, operator.ends_with?("~") ? "~" : "*", value, Journal.table_name, 'notes'})" +
</span><span class="gi">+ " AND (#{sql_for_field field, operator.sub(/^!/, ''), value, Journal.table_name, 'notes'})" +
</span> " AND (#{Journal.visible_notes_condition(User.current, :skip_pre_condition => true)})"
<span class="gd">- "#{operator.starts_with?("!") ? "NOT EXISTS" : "EXISTS"} (#{subquery})"
</span><span class="gi">+ "#{/^!/.match?(operator) ? "NOT EXISTS" : "EXISTS"} (#{subquery})"
</span> end
def sql_for_updated_by_field(field, operator, value)
</code></pre> Redmine - Feature #5893: Filter issues by noteshttps://www.redmine.org/issues/5893?journal_id=1018322021-04-05T09:17:33ZGo MAEDA
<ul><li><strong>Target version</strong> changed from <i>Candidate for next major release</i> to <i>5.0.0</i></li></ul><p>Setting the target version to 5.0.0.</p> Redmine - Feature #5893: Filter issues by noteshttps://www.redmine.org/issues/5893?journal_id=1018332021-04-05T09:58:35ZGo MAEDA
<ul><li><strong>File</strong> <a href="/attachments/27059">statement-invalid-log.txt</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/27059/statement-invalid-log.txt">statement-invalid-log.txt</a> added</li><li><strong>Target version</strong> changed from <i>5.0.0</i> to <i>Candidate for next major release</i></li></ul><p>While I was trying the patch, I came across an SQL error (sorry, I don't know how to reproduce).</p>
<pre>
Query::StatementInvalid: SQLite3::SQLException: no such column: issues.notes
</pre> Redmine - Feature #5893: Filter issues by noteshttps://www.redmine.org/issues/5893?journal_id=1020332021-04-15T02:16:44ZGo MAEDA
<ul><li><strong>Target version</strong> changed from <i>Candidate for next major release</i> to <i>5.0.0</i></li></ul><p>Go MAEDA wrote:</p>
<blockquote>
<p>While I was trying the patch, I came across an SQL error (sorry, I don't know how to reproduce).</p>
<p>[...]</p>
</blockquote>
<p>I have been investigating this issue for a while, and the only time I could reproduce the error was when I removed the sql_for_notes_field method.</p>
<p>The error reported in <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: Filter issues by notes (Closed)" href="https://www.redmine.org/issues/5893#note-16">#5893#note-16</a> is probably due to my tampering the source code while checking the patch.</p>
<p>Setting the target version to 5.0.0 again.</p> Redmine - Feature #5893: Filter issues by noteshttps://www.redmine.org/issues/5893?journal_id=1021552021-04-21T07:01:19ZGo MAEDA
<ul><li><strong>Subject</strong> changed from <i>Filter Options: Allow to filter for description and notes</i> to <i>Filter issues by notes</i></li><li><strong>Status</strong> changed from <i>New</i> to <i>Closed</i></li><li><strong>Assignee</strong> set to <i>Go MAEDA</i></li></ul><p>Committed the patch. Thank you for your contribution.</p> Redmine - Feature #5893: Filter issues by noteshttps://www.redmine.org/issues/5893?journal_id=1026192021-05-31T05:00:48ZGo MAEDA
<ul><li><strong>Tracker</strong> changed from <i>Patch</i> to <i>Feature</i></li></ul> Redmine - Feature #5893: Filter issues by noteshttps://www.redmine.org/issues/5893?journal_id=1061612022-03-27T02:56:03ZGo MAEDA
<ul><li><strong>Category</strong> changed from <i>Issues filter</i> to <i>Filters</i></li></ul>