summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-09-13 11:36:09 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-09-13 11:36:09 +0000
commit3d0fbea9fdfdea61eaade8bb11d30c472a7c0e7e (patch)
tree0272c8f82f8d9636f378e94fea3deedef2e9a295
parent3d68b600636ecdefbccec9047ab9636e8a8a6445 (diff)
downloadredmine-3d0fbea9fdfdea61eaade8bb11d30c472a7c0e7e.tar.gz
redmine-3d0fbea9fdfdea61eaade8bb11d30c472a7c0e7e.zip
Merged r2797, r2804, r2814, r2820, r2837, r2838 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.8-stable@2881 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/controllers/news_controller.rb1
-rw-r--r--app/helpers/application_helper.rb2
-rw-r--r--app/models/mail_handler.rb2
-rw-r--r--app/views/mailer/reminder.text.html.rhtml2
-rw-r--r--app/views/wiki/special_date_index.rhtml4
-rw-r--r--app/views/wiki/special_page_index.rhtml4
-rw-r--r--doc/CHANGELOG5
-rw-r--r--test/fixtures/mail_handler/ticket_with_spaces_between_attribute_and_separator.eml43
-rw-r--r--test/functional/news_controller_test.rb9
-rw-r--r--test/unit/helpers/application_helper_test.rb5
-rw-r--r--test/unit/mail_handler_test.rb15
11 files changed, 85 insertions, 7 deletions
diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb
index b5f7ca1b2..884820946 100644
--- a/app/controllers/news_controller.rb
+++ b/app/controllers/news_controller.rb
@@ -65,6 +65,7 @@ class NewsController < ApplicationController
flash[:notice] = l(:label_comment_added)
redirect_to :action => 'show', :id => @news
else
+ show
render :action => 'show'
end
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index f82c01384..261c8d34e 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -385,7 +385,7 @@ module ApplicationHelper
# export:some/file -> Force the download of the file
# Forum messages:
# message#1218 -> Link to message with id 1218
- text = text.gsub(%r{([\s\(,\-\>]|^)(!)?(attachment|document|version|commit|source|export|message)?((#|r)(\d+)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]]\W)|\s|<|$)}) do |m|
+ text = text.gsub(%r{([\s\(,\-\>]|^)(!)?(attachment|document|version|commit|source|export|message)?((#|r)(\d+)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]]\W)|,|\s|<|$)}) do |m|
leading, esc, prefix, sep, oid = $1, $2, $3, $5 || $7, $6 || $8
link = nil
if esc.nil?
diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb
index 4c6925cda..bf274ab39 100644
--- a/app/models/mail_handler.rb
+++ b/app/models/mail_handler.rb
@@ -168,7 +168,7 @@ class MailHandler < ActionMailer::Base
@keywords[attr]
else
@keywords[attr] = begin
- if (options[:override] || @@handler_options[:allow_override].include?(attr.to_s)) && plain_text_body.gsub!(/^#{attr}:[ \t]*(.+)\s*$/i, '')
+ if (options[:override] || @@handler_options[:allow_override].include?(attr.to_s)) && plain_text_body.gsub!(/^#{attr}[ \t]*:[ \t]*(.+)\s*$/i, '')
$1.strip
elsif !@@handler_options[:issue][attr].blank?
@@handler_options[:issue][attr]
diff --git a/app/views/mailer/reminder.text.html.rhtml b/app/views/mailer/reminder.text.html.rhtml
index 1e33fbe43..66f3177d2 100644
--- a/app/views/mailer/reminder.text.html.rhtml
+++ b/app/views/mailer/reminder.text.html.rhtml
@@ -2,7 +2,7 @@
<ul>
<% @issues.each do |issue| -%>
- <li><%=h "#{issue.project} - #{issue.tracker} ##{issue.id}: #{issue.subject}" %></li>
+ <li><%=h issue.project %> - <%=link_to("#{issue.tracker} ##{issue.id}", :controller => 'issues', :action => 'show', :id => issue, :only_path => false)%>: <%=h issue.subject %></li>
<% end -%>
</ul>
diff --git a/app/views/wiki/special_date_index.rhtml b/app/views/wiki/special_date_index.rhtml
index 6717ebc85..51176bc5b 100644
--- a/app/views/wiki/special_date_index.rhtml
+++ b/app/views/wiki/special_date_index.rhtml
@@ -20,11 +20,11 @@
<% unless @pages.empty? %>
<p class="other-formats">
<%= l(:label_export_to) %>
-<span><%= link_to 'Atom', {:controller => 'projects', :action => 'activity', :id => @project, :show_wiki_pages => 1, :format => 'atom', :key => User.current.rss_key}, :class => 'feed' %></span>
+<span><%= link_to 'Atom', {:controller => 'projects', :action => 'activity', :id => @project, :show_wiki_edits => 1, :format => 'atom', :key => User.current.rss_key}, :class => 'feed' %></span>
<span><%= link_to 'HTML', {:action => 'special', :page => 'export'}, :class => 'html' %></span>
</p>
<% end %>
<% content_for :header_tags do %>
-<%= auto_discovery_link_tag(:atom, :controller => 'projects', :action => 'activity', :id => @project, :show_wiki_pages => 1, :format => 'atom', :key => User.current.rss_key) %>
+<%= auto_discovery_link_tag(:atom, :controller => 'projects', :action => 'activity', :id => @project, :show_wiki_edits => 1, :format => 'atom', :key => User.current.rss_key) %>
<% end %>
diff --git a/app/views/wiki/special_page_index.rhtml b/app/views/wiki/special_page_index.rhtml
index 72b395ef7..2056df232 100644
--- a/app/views/wiki/special_page_index.rhtml
+++ b/app/views/wiki/special_page_index.rhtml
@@ -13,11 +13,11 @@
<% unless @pages.empty? %>
<p class="other-formats">
<%= l(:label_export_to) %>
-<span><%= link_to 'Atom', {:controller => 'projects', :action => 'activity', :id => @project, :show_wiki_pages => 1, :format => 'atom', :key => User.current.rss_key}, :class => 'feed' %></span>
+<span><%= link_to 'Atom', {:controller => 'projects', :action => 'activity', :id => @project, :show_wiki_edits => 1, :format => 'atom', :key => User.current.rss_key}, :class => 'feed' %></span>
<span><%= link_to 'HTML', {:action => 'special', :page => 'export'} %></span>
</p>
<% end %>
<% content_for :header_tags do %>
-<%= auto_discovery_link_tag(:atom, :controller => 'projects', :action => 'activity', :id => @project, :show_wiki_pages => 1, :format => 'atom', :key => User.current.rss_key) %>
+<%= auto_discovery_link_tag(:atom, :controller => 'projects', :action => 'activity', :id => @project, :show_wiki_edits => 1, :format => 'atom', :key => User.current.rss_key) %>
<% end %>
diff --git a/doc/CHANGELOG b/doc/CHANGELOG
index f9523fb03..c44079123 100644
--- a/doc/CHANGELOG
+++ b/doc/CHANGELOG
@@ -7,6 +7,11 @@ http://www.redmine.org/
== 2009-xx-xx v0.8.5
+* Incoming mail handler : Allow spaces between keywords and colon
+* Do not require a non-word character after a comma in Redmine links
+* Include issue hyperlinks in reminder emails
+* Fixed: 500 Internal Server Error is raised if add an empty comment to the news
+* Fixes: Atom links for wiki pages are not correct
* Fixed: Atom feeds leak email address
diff --git a/test/fixtures/mail_handler/ticket_with_spaces_between_attribute_and_separator.eml b/test/fixtures/mail_handler/ticket_with_spaces_between_attribute_and_separator.eml
new file mode 100644
index 000000000..995ef01e8
--- /dev/null
+++ b/test/fixtures/mail_handler/ticket_with_spaces_between_attribute_and_separator.eml
@@ -0,0 +1,43 @@
+Return-Path: <jsmith@somenet.foo>
+Received: from osiris ([127.0.0.1])
+ by OSIRIS
+ with hMailServer ; Sun, 22 Jun 2008 12:28:07 +0200
+Message-ID: <000501c8d452$a95cd7e0$0a00a8c0@osiris>
+From: "John Smith" <jsmith@somenet.foo>
+To: <redmine@somenet.foo>
+Subject: New ticket on a given project
+Date: Sun, 22 Jun 2008 12:28:07 +0200
+MIME-Version: 1.0
+Content-Type: text/plain;
+ format=flowed;
+ charset="iso-8859-1";
+ reply-type=original
+Content-Transfer-Encoding: 7bit
+X-Priority: 3
+X-MSMail-Priority: Normal
+X-Mailer: Microsoft Outlook Express 6.00.2900.2869
+X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869
+
+Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas imperdiet
+turpis et odio. Integer eget pede vel dolor euismod varius. Phasellus
+blandit eleifend augue. Nulla facilisi. Duis id diam. Class aptent taciti
+sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In
+in urna sed tellus aliquet lobortis. Morbi scelerisque tortor in dolor. Cras
+sagittis odio eu lacus. Aliquam sem tortor, consequat sit amet, vestibulum
+id, iaculis at, lectus. Fusce tortor libero, congue ut, euismod nec, luctus
+eget, eros. Pellentesque tortor enim, feugiat in, dignissim eget, tristique
+sed, mauris. Pellentesque habitant morbi tristique senectus et netus et
+malesuada fames ac turpis egestas. Quisque sit amet libero. In hac habitasse
+platea dictumst.
+
+Nulla et nunc. Duis pede. Donec et ipsum. Nam ut dui tincidunt neque
+sollicitudin iaculis. Duis vitae dolor. Vestibulum eget massa. Sed lorem.
+Nullam volutpat cursus erat. Cras felis dolor, lacinia quis, rutrum et,
+dictum et, ligula. Sed erat nibh, gravida in, accumsan non, placerat sed,
+massa. Sed sodales, ante fermentum ultricies sollicitudin, massa leo
+pulvinar dui, a gravida orci mi eget odio. Nunc a lacus.
+
+Project : onlinestore
+Tracker: Feature request
+category : Stock management
+priority: Urgent
diff --git a/test/functional/news_controller_test.rb b/test/functional/news_controller_test.rb
index 01f8015b9..22b758efe 100644
--- a/test/functional/news_controller_test.rb
+++ b/test/functional/news_controller_test.rb
@@ -118,6 +118,15 @@ class NewsControllerTest < Test::Unit::TestCase
assert_equal User.find(2), comment.author
end
+ def test_empty_comment_should_not_be_added
+ @request.session[:user_id] = 2
+ assert_no_difference 'Comment.count' do
+ post :add_comment, :id => 1, :comment => { :comments => '' }
+ assert_response :success
+ assert_template 'show'
+ end
+ end
+
def test_destroy_comment
comments_count = News.find(1).comments.size
@request.session[:user_id] = 2
diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb
index 28d2ee495..a16202f86 100644
--- a/test/unit/helpers/application_helper_test.rb
+++ b/test/unit/helpers/application_helper_test.rb
@@ -122,6 +122,8 @@ class ApplicationHelperTest < HelperTestCase
changeset_link = link_to('r1', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :rev => 1},
:class => 'changeset', :title => 'My very first commit')
+ changeset_link2 = link_to('r2', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :rev => 2},
+ :class => 'changeset', :title => 'This commit fixes #1, #2 and references #1 & #3')
document_link = link_to('Test document', {:controller => 'documents', :action => 'show', :id => 1},
:class => 'document')
@@ -139,6 +141,9 @@ class ApplicationHelperTest < HelperTestCase
'#3, #3 and #3.' => "#{issue_link}, #{issue_link} and #{issue_link}.",
# changesets
'r1' => changeset_link,
+ 'r1.' => "#{changeset_link}.",
+ 'r1, r2' => "#{changeset_link}, #{changeset_link2}",
+ 'r1,r2' => "#{changeset_link},#{changeset_link2}",
# documents
'document#1' => document_link,
'document:"Test document"' => document_link,
diff --git a/test/unit/mail_handler_test.rb b/test/unit/mail_handler_test.rb
index 5840ba556..299f31fab 100644
--- a/test/unit/mail_handler_test.rb
+++ b/test/unit/mail_handler_test.rb
@@ -92,6 +92,21 @@ class MailHandlerTest < Test::Unit::TestCase
assert issue.description.include?('Lorem ipsum dolor sit amet, consectetuer adipiscing elit.')
end
+ def test_add_issue_with_spaces_between_attribute_and_separator
+ issue = submit_email('ticket_with_spaces_between_attribute_and_separator.eml', :allow_override => 'tracker,category,priority')
+ assert issue.is_a?(Issue)
+ assert !issue.new_record?
+ issue.reload
+ assert_equal 'New ticket on a given project', issue.subject
+ assert_equal User.find_by_login('jsmith'), issue.author
+ assert_equal Project.find(2), issue.project
+ assert_equal 'Feature request', issue.tracker.to_s
+ assert_equal 'Stock management', issue.category.to_s
+ assert_equal 'Urgent', issue.priority.to_s
+ assert issue.description.include?('Lorem ipsum dolor sit amet, consectetuer adipiscing elit.')
+ end
+
+
def test_add_issue_with_attachment_to_specific_project
issue = submit_email('ticket_with_attachment.eml', :issue => {:project => 'onlinestore'})
assert issue.is_a?(Issue)