From bd434427e61edbac03d273a308dcfffe72096ae0 Mon Sep 17 00:00:00 2001
From: Jean-Philippe Lang <%= l(:mail_body_account_information_external, @user.auth_source.name) %> <%= l(:mail_body_account_information) %>: <%= l(:label_login) %>: <%= auto_link(@login_url) %> <%= l(:mail_body_lost_password) %> <%= l(:mail_body_register) %> This is a test email sent by Redmine.<%= link_to "#{issue.tracker.name} ##{issue.id}: #{issue.subject}", issue_url %>
<%= textilizable(@journal.notes) %>
+
+<% end %>
+
+
+<%= link_to @added_to, @added_to_url %>
<% @attachments.each do |attachment | %>
-
-<%= textilizable Setting.emails_footer %>
diff --git a/app/views/mailer/attachments_added.text.plain.rhtml b/app/views/mailer/attachments_added.text.plain.rhtml
index 7e4245ef..28cb8285 100644
--- a/app/views/mailer/attachments_added.text.plain.rhtml
+++ b/app/views/mailer/attachments_added.text.plain.rhtml
@@ -1,6 +1,4 @@
<%= @added_to %><% @attachments.each do |attachment | %>
- <%= attachment.filename %><% end %>
-<%= url_for @url %>
-----------------------------------------
-<%= Setting.emails_footer %>
+<%= @added_to_url %>
diff --git a/app/views/mailer/document_added.text.html.rhtml b/app/views/mailer/document_added.text.html.rhtml
index d7d6558b..2ef63012 100644
--- a/app/views/mailer/document_added.text.html.rhtml
+++ b/app/views/mailer/document_added.text.html.rhtml
@@ -1,6 +1,3 @@
-<%= link_to @document.title, :only_path => false, :host => Setting.host_name, :controller => 'documents', :action => 'show', :id => @document %>
-(<%= @document.category.name %>)
+<%= link_to @document.title, @document_url %> (<%= @document.category.name %>)
<%= textilizable(@document.description) %>
-
-<%= textilizable Setting.emails_footer %>
diff --git a/app/views/mailer/document_added.text.plain.rhtml b/app/views/mailer/document_added.text.plain.rhtml
index bb42758f..a6a72829 100644
--- a/app/views/mailer/document_added.text.plain.rhtml
+++ b/app/views/mailer/document_added.text.plain.rhtml
@@ -1,6 +1,4 @@
<%= @document.title %> (<%= @document.category.name %>)
-<%= url_for :only_path => false, :host => Setting.host_name, :controller => 'documents', :action => 'show', :id => @document %>
+<%= @document_url %>
<%= @document.description %>
-----------------------------------------
-<%= Setting.emails_footer %>
diff --git a/app/views/mailer/issue_add.text.html.rhtml b/app/views/mailer/issue_add.text.html.rhtml
index 7a0712c3..adcb4c9f 100644
--- a/app/views/mailer/issue_add.text.html.rhtml
+++ b/app/views/mailer/issue_add.text.html.rhtml
@@ -1,5 +1,3 @@
<%= l(:text_issue_added, "##{@issue.id}") %>
-<%= render :file => "_issue_text_html", :use_full_path => true, :locals => { :issue => @issue } %>
-
-<%= textilizable Setting.emails_footer %>
+<%= render :file => "_issue_text_html", :use_full_path => true, :locals => { :issue => @issue, :issue_url => @issue_url } %>
diff --git a/app/views/mailer/issue_add.text.plain.rhtml b/app/views/mailer/issue_add.text.plain.rhtml
index a5740ad8..797fb11b 100644
--- a/app/views/mailer/issue_add.text.plain.rhtml
+++ b/app/views/mailer/issue_add.text.plain.rhtml
@@ -1,5 +1,3 @@
<%= l(:text_issue_added, "##{@issue.id}") %>
----------------------------------------
-<%= render :file => "_issue_text_plain", :use_full_path => true, :locals => { :issue => @issue } %>
-----------------------------------------
-<%= Setting.emails_footer %>
+<%= render :file => "_issue_text_plain", :use_full_path => true, :locals => { :issue => @issue, :issue_url => @issue_url } %>
diff --git a/app/views/mailer/issue_edit.text.html.rhtml b/app/views/mailer/issue_edit.text.html.rhtml
index fddd1943..40d34968 100644
--- a/app/views/mailer/issue_edit.text.html.rhtml
+++ b/app/views/mailer/issue_edit.text.html.rhtml
@@ -7,6 +7,4 @@
-<%= render :file => "_issue_text_html", :use_full_path => true, :locals => { :issue => @issue } %>
-
-<%= textilizable Setting.emails_footer %>
+<%= render :file => "_issue_text_html", :use_full_path => true, :locals => { :issue => @issue, :issue_url => @issue_url } %>
diff --git a/app/views/mailer/issue_edit.text.plain.rhtml b/app/views/mailer/issue_edit.text.plain.rhtml
index 4ecc3754..32019eae 100644
--- a/app/views/mailer/issue_edit.text.plain.rhtml
+++ b/app/views/mailer/issue_edit.text.plain.rhtml
@@ -5,6 +5,4 @@
<% end %>
<%= @journal.notes if @journal.notes? %>
----------------------------------------
-<%= render :file => "_issue_text_plain", :use_full_path => true, :locals => { :issue => @issue } %>
-----------------------------------------
-<%= Setting.emails_footer %>
+<%= render :file => "_issue_text_plain", :use_full_path => true, :locals => { :issue => @issue, :issue_url => @issue_url } %>
diff --git a/app/views/mailer/layout.text.html.rhtml b/app/views/mailer/layout.text.html.rhtml
new file mode 100644
index 00000000..b78e92bd
--- /dev/null
+++ b/app/views/mailer/layout.text.html.rhtml
@@ -0,0 +1,17 @@
+
+
+
+
+
+<%= yield %>
+
+
+
+
diff --git a/app/views/mailer/layout.text.plain.rhtml b/app/views/mailer/layout.text.plain.rhtml
new file mode 100644
index 00000000..ec3e1bfa
--- /dev/null
+++ b/app/views/mailer/layout.text.plain.rhtml
@@ -0,0 +1,3 @@
+<%= yield %>
+----------------------------------------
+<%= Setting.emails_footer %>
diff --git a/app/views/mailer/lost_password.rhtml b/app/views/mailer/lost_password.rhtml
deleted file mode 100644
index 5b5bb3b9..00000000
--- a/app/views/mailer/lost_password.rhtml
+++ /dev/null
@@ -1,5 +0,0 @@
-<%= l(:mail_body_lost_password) %>
-<%= url_for :only_path => false, :host => Setting.host_name, :controller => 'account', :action => 'lost_password', :token => @token.value %>
-
-----------------------------------------
-<%= Setting.emails_footer %>
diff --git a/app/views/mailer/lost_password.text.html.rhtml b/app/views/mailer/lost_password.text.html.rhtml
new file mode 100644
index 00000000..26eacfa9
--- /dev/null
+++ b/app/views/mailer/lost_password.text.html.rhtml
@@ -0,0 +1,2 @@
+
+<%= auto_link(@url) %>
+<%=h @message.board.project.name %> - <%=h @message.board.name %>: <%= link_to @message.subject, @message_url %>
<%= @message.author.name %>
<%= textilizable @message.content %>
-
-<%= textilizable Setting.emails_footer %>
diff --git a/app/views/mailer/message_posted.text.plain.rhtml b/app/views/mailer/message_posted.text.plain.rhtml
index 97539fd0..cc112056 100644
--- a/app/views/mailer/message_posted.text.plain.rhtml
+++ b/app/views/mailer/message_posted.text.plain.rhtml
@@ -1,6 +1,4 @@
-<%= url_for :only_path => false, :host => Setting.host_name, :controller => 'messages', :action => 'show', :board_id => @message.board_id, :id => @message.root %>
+<%= @message_url %>
<%= @message.author.name %>
<%= @message.content %>
-----------------------------------------
-<%= Setting.emails_footer %>
diff --git a/app/views/mailer/news_added.text.html.rhtml b/app/views/mailer/news_added.text.html.rhtml
index e99dfd5b..010ef8ee 100644
--- a/app/views/mailer/news_added.text.html.rhtml
+++ b/app/views/mailer/news_added.text.html.rhtml
@@ -1,6 +1,4 @@
-<%= link_to @news.title, :only_path => false, :host => Setting.host_name, :controller => 'news', :action => 'show', :id => @news %>
+<%= link_to @news.title, @news_url %>
<%= @news.author.name %>
<%= textilizable(@news.description) %>
-
-<%= textilizable Setting.emails_footer %>
diff --git a/app/views/mailer/news_added.text.plain.rhtml b/app/views/mailer/news_added.text.plain.rhtml
index 1a04af9c..c8ae3035 100644
--- a/app/views/mailer/news_added.text.plain.rhtml
+++ b/app/views/mailer/news_added.text.plain.rhtml
@@ -1,7 +1,5 @@
<%= @news.title %>
-<%= url_for :only_path => false, :host => Setting.host_name, :controller => 'news', :action => 'show', :id => @news %>
+<%= @news_url %>
<%= @news.author.name %>
<%= @news.description %>
-----------------------------------------
-<%= Setting.emails_footer %>
diff --git a/app/views/mailer/register.rhtml b/app/views/mailer/register.rhtml
deleted file mode 100644
index 55fcf1e1..00000000
--- a/app/views/mailer/register.rhtml
+++ /dev/null
@@ -1,5 +0,0 @@
-<%= l(:mail_body_register) %>
-<%= url_for :only_path => false, :host => Setting.host_name, :controller => 'account', :action => 'register', :token => @token.value %>
-
-----------------------------------------
-<%= Setting.emails_footer %>
diff --git a/app/views/mailer/register.text.html.rhtml b/app/views/mailer/register.text.html.rhtml
new file mode 100644
index 00000000..145c3d7c
--- /dev/null
+++ b/app/views/mailer/register.text.html.rhtml
@@ -0,0 +1,2 @@
+
+<%= auto_link(@url) %>
-Redmine URL: <%= link_to url_for(:only_path => false, :host => Setting.host_name, :controller => 'welcome'),
- url_for(:only_path => false, :host => Setting.host_name, :controller => 'welcome') %>
-<%= textilizable Setting.emails_footer %>
+Redmine URL: <%= auto_link(@url) %>
<%= text_field_tag 'settings[host_name]', Setting.host_name, :size => 60 %>
++<%= select_tag 'settings[protocol]', options_for_select(['http', 'https'], Setting.protocol) %>
+<%= select_tag 'settings[text_formatting]', options_for_select([[l(:label_none), "0"], ["textile", "textile"]], Setting.text_formatting) %>
@@ -91,4 +94,4 @@ <%= submit_tag l(:button_save) %> -<% end %> \ No newline at end of file +<% end %> diff --git a/config/settings.yml b/config/settings.yml index ff695cc7..333203f0 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -47,6 +47,8 @@ default_language: default: en host_name: default: localhost:3000 +protocol: + default: http feeds_limit: format: int default: 15 diff --git a/lang/bg.yml b/lang/bg.yml index 366aa94a..46979253 100644 --- a/lang/bg.yml +++ b/lang/bg.yml @@ -534,3 +534,6 @@ label_user_mail_option_none: "Only for things I watch or I'm involved in" setting_emails_footer: Emails footer label_float: Float button_copy: Copy +mail_body_account_information_external: You can use your "%s" account to log into Redmine. +mail_body_account_information: Your Redmine account information +setting_protocol: Protocol diff --git a/lang/cs.yml b/lang/cs.yml index 4f35c8a3..d6274663 100644 --- a/lang/cs.yml +++ b/lang/cs.yml @@ -534,3 +534,6 @@ label_user_mail_option_none: "Only for things I watch or I'm involved in" setting_emails_footer: Emails footer label_float: Float button_copy: Copy +mail_body_account_information_external: You can use your "%s" account to log into Redmine. +mail_body_account_information: Your Redmine account information +setting_protocol: Protocol diff --git a/lang/de.yml b/lang/de.yml index 350a86e4..9a5fcee2 100644 --- a/lang/de.yml +++ b/lang/de.yml @@ -534,3 +534,6 @@ label_user_mail_option_none: "Only for things I watch or I'm involved in" setting_emails_footer: Emails footer label_float: Float button_copy: Copy +mail_body_account_information_external: You can use your "%s" account to log into Redmine. +mail_body_account_information: Your Redmine account information +setting_protocol: Protocol diff --git a/lang/en.yml b/lang/en.yml index 4a52d281..2ab4c11a 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -80,6 +80,8 @@ mail_subject_lost_password: Your Redmine password mail_body_lost_password: 'To change your Redmine password, click on the following link:' mail_subject_register: Redmine account activation mail_body_register: 'To activate your Redmine account, click on the following link:' +mail_body_account_information_external: You can use your "%s" account to log into Redmine. +mail_body_account_information: Your Redmine account information gui_validation_error: 1 error gui_validation_error_plural: %d errors @@ -189,6 +191,7 @@ setting_cross_project_issue_relations: Allow cross-project issue relations setting_issue_list_default_columns: Default columns displayed on the issue list setting_repositories_encodings: Repositories encodings setting_emails_footer: Emails footer +setting_protocol: Protocol label_user: User label_user_plural: Users diff --git a/lang/es.yml b/lang/es.yml index 5d1f806c..e93fb5bd 100644 --- a/lang/es.yml +++ b/lang/es.yml @@ -537,3 +537,6 @@ label_user_mail_option_none: "Only for things I watch or I'm involved in" setting_emails_footer: Emails footer label_float: Float button_copy: Copy +mail_body_account_information_external: You can use your "%s" account to log into Redmine. +mail_body_account_information: Your Redmine account information +setting_protocol: Protocol diff --git a/lang/fr.yml b/lang/fr.yml index e5a2b843..1f35272c 100644 --- a/lang/fr.yml +++ b/lang/fr.yml @@ -80,6 +80,8 @@ mail_subject_lost_password: Votre mot de passe redMine mail_body_lost_password: 'Pour changer votre mot de passe Redmine, cliquez sur le lien suivant:' mail_subject_register: Activation de votre compte redMine mail_body_register: 'Pour activer votre compte Redmine, cliquez sur le lien suivant:' +mail_body_account_information_external: Vous pouvez utiliser votre compte "%s" pour vous connecter à Redmine. +mail_body_account_information: Paramètres de connexion de votre compte Redmine gui_validation_error: 1 erreur gui_validation_error_plural: %d erreurs @@ -189,6 +191,7 @@ setting_cross_project_issue_relations: Autoriser les relations entre demandes de setting_issue_list_default_columns: Colonnes affichées par défaut sur la liste des demandes setting_repositories_encodings: Encodages des dépôts setting_emails_footer: Pied-de-page des emails +setting_protocol: Protocole label_user: Utilisateur label_user_plural: Utilisateurs diff --git a/lang/he.yml b/lang/he.yml index 206d3309..73f72d5b 100644 --- a/lang/he.yml +++ b/lang/he.yml @@ -534,3 +534,6 @@ label_user_mail_option_none: "Only for things I watch or I'm involved in" setting_emails_footer: Emails footer label_float: Float button_copy: Copy +mail_body_account_information_external: You can use your "%s" account to log into Redmine. +mail_body_account_information: Your Redmine account information +setting_protocol: Protocol diff --git a/lang/it.yml b/lang/it.yml index 36475e67..224843e0 100644 --- a/lang/it.yml +++ b/lang/it.yml @@ -534,3 +534,6 @@ label_user_mail_option_none: "Only for things I watch or I'm involved in" setting_emails_footer: Emails footer label_float: Float button_copy: Copy +mail_body_account_information_external: You can use your "%s" account to log into Redmine. +mail_body_account_information: Your Redmine account information +setting_protocol: Protocol diff --git a/lang/ja.yml b/lang/ja.yml index 5a3362c2..4ff45f5f 100644 --- a/lang/ja.yml +++ b/lang/ja.yml @@ -535,3 +535,6 @@ label_user_mail_option_none: "Only for things I watch or I'm involved in" setting_emails_footer: Emails footer label_float: Float button_copy: Copy +mail_body_account_information_external: You can use your "%s" account to log into Redmine. +mail_body_account_information: Your Redmine account information +setting_protocol: Protocol diff --git a/lang/nl.yml b/lang/nl.yml index 4d9479f3..f43f5a5b 100644 --- a/lang/nl.yml +++ b/lang/nl.yml @@ -535,3 +535,6 @@ label_user_mail_option_none: "Only for things I watch or I'm involved in" setting_emails_footer: Emails footer label_float: Float button_copy: Copy +mail_body_account_information_external: You can use your "%s" account to log into Redmine. +mail_body_account_information: Your Redmine account information +setting_protocol: Protocol diff --git a/lang/pl.yml b/lang/pl.yml index 6f8d7f2f..e636afe5 100644 --- a/lang/pl.yml +++ b/lang/pl.yml @@ -534,3 +534,6 @@ label_user_mail_option_none: "Only for things I watch or I'm involved in" setting_emails_footer: Emails footer label_float: Float button_copy: Copy +mail_body_account_information_external: Możesz użyć twojego "%s" konta do zalogowania do Redmine. +mail_body_account_information: Twoje konto w Redmine +setting_protocol: Protocol diff --git a/lang/pt-br.yml b/lang/pt-br.yml index a0179397..707baffc 100644 --- a/lang/pt-br.yml +++ b/lang/pt-br.yml @@ -534,3 +534,6 @@ label_user_mail_option_none: "Only for things I watch or I'm involved in" setting_emails_footer: Emails footer label_float: Float button_copy: Copy +mail_body_account_information_external: You can use your "%s" account to log into Redmine. +mail_body_account_information: Your Redmine account information +setting_protocol: Protocol diff --git a/lang/pt.yml b/lang/pt.yml index da919938..687ab512 100644 --- a/lang/pt.yml +++ b/lang/pt.yml @@ -534,3 +534,6 @@ label_user_mail_option_none: "Only for things I watch or I'm involved in" setting_emails_footer: Emails footer label_float: Float button_copy: Copy +mail_body_account_information_external: You can use your "%s" account to log into Redmine. +mail_body_account_information: Your Redmine account information +setting_protocol: Protocol diff --git a/lang/ro.yml b/lang/ro.yml index 73280933..f31bd6f8 100644 --- a/lang/ro.yml +++ b/lang/ro.yml @@ -534,3 +534,6 @@ label_user_mail_option_none: "Only for things I watch or I'm involved in" setting_emails_footer: Emails footer label_float: Float button_copy: Copy +mail_body_account_information_external: You can use your "%s" account to log into Redmine. +mail_body_account_information: Your Redmine account information +setting_protocol: Protocol diff --git a/lang/sr.yml b/lang/sr.yml index 96cd9273..d9585573 100644 --- a/lang/sr.yml +++ b/lang/sr.yml @@ -80,6 +80,8 @@ mail_subject_lost_password: Vaša redMine lozinka mail_body_lost_password: 'Da biste izmenili vašu Redmine lozinku, kliknite na sledeći link:' mail_subject_register: aktivacija redMine naloga mail_body_register: 'Da biste aktivirali vaš Redmine nalog, kliknite na sledeći link:' +mail_body_account_information_external: Mozete koristiti vas "%s" nalog da bi ste se prikljucili na Redmine. +mail_body_account_information: Informacije o vasem Redmine nalogu gui_validation_error: 1 greška gui_validation_error_plural: %d grešaka @@ -535,3 +537,4 @@ enumeration_doc_categories: Kategorija dokumenata enumeration_activities: Aktivnosti (praćenje vremena)) label_float: Float button_copy: Copy +setting_protocol: Protocol diff --git a/lang/sv.yml b/lang/sv.yml index ae1329db..0cd4f1a1 100644 --- a/lang/sv.yml +++ b/lang/sv.yml @@ -535,3 +535,6 @@ label_user_mail_option_none: "Only for things I watch or I'm involved in" setting_emails_footer: Emails footer label_float: Float button_copy: Copy +mail_body_account_information_external: You can use your "%s" account to log into Redmine. +mail_body_account_information: Your Redmine account information +setting_protocol: Protocol diff --git a/lang/zh.yml b/lang/zh.yml index a7ce17e1..71501092 100644 --- a/lang/zh.yml +++ b/lang/zh.yml @@ -537,3 +537,6 @@ label_user_mail_option_none: "Only for things I watch or I'm involved in" setting_emails_footer: Emails footer label_float: Float button_copy: Copy +mail_body_account_information_external: You can use your "%s" account to log into Redmine. +mail_body_account_information: Your Redmine account information +setting_protocol: Protocol diff --git a/test/fixtures/attachments.yml b/test/fixtures/attachments.yml index 6c352e1e..76494875 100644 --- a/test/fixtures/attachments.yml +++ b/test/fixtures/attachments.yml @@ -11,3 +11,16 @@ attachments_001: filesize: 28 filename: error281.txt author_id: 2 +attachments_002: + created_on: 2006-07-19 21:07:27 +02:00 + downloads: 0 + content_type: text/plain + disk_filename: 060719210727_document.txt + container_id: 1 + digest: b91e08d0cf966d5c6ff411bd8c4cc3a2 + id: 2 + container_type: Document + filesize: 28 + filename: document.txt + author_id: 2 + \ No newline at end of file diff --git a/test/unit/mailer_test.rb b/test/unit/mailer_test.rb index d92c5837..096551ee 100644 --- a/test/unit/mailer_test.rb +++ b/test/unit/mailer_test.rb @@ -18,7 +18,7 @@ require File.dirname(__FILE__) + '/../test_helper' class MailerTest < Test::Unit::TestCase - fixtures :projects, :issues, :users, :members, :documents, :attachments, :tokens, :journals, :journal_details, :trackers, :issue_statuses, :enumerations + fixtures :projects, :issues, :users, :members, :documents, :attachments, :news, :tokens, :journals, :journal_details, :trackers, :issue_statuses, :enumerations # test mailer methods for each language def test_issue_add @@ -37,18 +37,54 @@ class MailerTest < Test::Unit::TestCase end end - def test_document_add + def test_document_added document = Document.find(1) GLoc.valid_languages.each do |lang| Setting.default_language = lang.to_s assert Mailer.deliver_document_added(document) end end + + def test_attachments_added + attachements = [ Attachment.find_by_container_type('Document') ] + GLoc.valid_languages.each do |lang| + Setting.default_language = lang.to_s + assert Mailer.deliver_attachments_added(attachements) + end + end + + def test_news_added + news = News.find(:first) + GLoc.valid_languages.each do |lang| + Setting.default_language = lang.to_s + assert Mailer.deliver_news_added(news) + end + end + + def test_message_posted + message = Message.find(:first) + recipients = ([message.root] + message.root.children).collect {|m| m.author.mail if m.author} + recipients = recipients.compact.uniq + GLoc.valid_languages.each do |lang| + Setting.default_language = lang.to_s + assert Mailer.deliver_message_posted(message, recipients) + end + end + + def test_account_information + user = User.find(:first) + GLoc.valid_languages.each do |lang| + user.update_attribute :language, lang.to_s + user.reload + assert Mailer.deliver_account_information(user, 'pAsswORd') + end + end def test_lost_password token = Token.find(2) GLoc.valid_languages.each do |lang| token.user.update_attribute :language, lang.to_s + token.reload assert Mailer.deliver_lost_password(token) end end @@ -57,7 +93,8 @@ class MailerTest < Test::Unit::TestCase token = Token.find(1) GLoc.valid_languages.each do |lang| token.user.update_attribute :language, lang.to_s + token.reload assert Mailer.deliver_register(token) end end -end \ No newline at end of file +end