diff --git a/app/controllers/settings_controller.rb b/app/controllers/settings_controller.rb
index 7d99a726..c1d94850 100644
--- a/app/controllers/settings_controller.rb
+++ b/app/controllers/settings_controller.rb
@@ -24,7 +24,7 @@ class SettingsController < ApplicationController
end
def edit
- @notifiables = %w(issue_added issue_updated news_added document_added file_added message_posted)
+ @notifiables = %w(issue_added issue_updated news_added document_added file_added message_posted wiki_content_added wiki_content_updated)
if request.post? && params[:settings] && params[:settings].is_a?(Hash)
settings = (params[:settings] || {}).dup.symbolize_keys
settings.each do |name, value|
diff --git a/app/models/mailer.rb b/app/models/mailer.rb
index 992fd50c..993d85da 100644
--- a/app/models/mailer.rb
+++ b/app/models/mailer.rb
@@ -152,6 +152,37 @@ class Mailer < ActionMailer::Base
body :message => message,
:message_url => url_for(:controller => 'messages', :action => 'show', :board_id => message.board_id, :id => message.root)
end
+
+ # Builds a tmail object used to email the recipients of a project of the specified wiki content was updated.
+ #
+ # Example:
+ # wiki_content_updated(wiki_content) => tmail object
+ # Mailer.deliver_wiki_content_updated(wiki_content) => sends an email to the project's recipients
+ def wiki_content_added(wiki_content)
+ redmine_headers 'Project' => wiki_content.project.identifier,
+ 'Wiki-Page-Id' => wiki_content.page.id
+ message_id wiki_content
+ recipients wiki_content.project.recipients
+ subject "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_added, :page => wiki_content.page.pretty_title)}"
+ body :wiki_content => wiki_content,
+ :wiki_content_url => url_for(:controller => 'wiki', :action => 'index', :id => wiki_content.project, :page => wiki_content.page.title)
+ end
+
+ # Builds a tmail object used to email the recipients of a project of the specified wiki content was updated.
+ #
+ # Example:
+ # wiki_content_updated(wiki_content) => tmail object
+ # Mailer.deliver_wiki_content_updated(wiki_content) => sends an email to the project's recipients
+ def wiki_content_updated(wiki_content)
+ redmine_headers 'Project' => wiki_content.project.identifier,
+ 'Wiki-Page-Id' => wiki_content.page.id
+ message_id wiki_content
+ recipients wiki_content.project.recipients
+ subject "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_updated, :page => wiki_content.page.pretty_title)}"
+ body :wiki_content => wiki_content,
+ :wiki_content_url => url_for(:controller => 'wiki', :action => 'index', :id => wiki_content.project, :page => wiki_content.page.title),
+ :wiki_diff_url => url_for(:controller => 'wiki', :action => 'diff', :id => wiki_content.project, :page => wiki_content.page.title, :version => wiki_content.version)
+ end
# Builds a tmail object used to email the specified user their account information.
#
@@ -325,7 +356,8 @@ class Mailer < ActionMailer::Base
def self.message_id_for(object)
# id + timestamp should reduce the odds of a collision
# as far as we don't send multiple emails for the same object
- hash = "redmine.#{object.class.name.demodulize.underscore}-#{object.id}.#{object.created_on.strftime("%Y%m%d%H%M%S")}"
+ timestamp = object.send(object.respond_to?(:created_on) ? :created_on : :updated_on)
+ hash = "redmine.#{object.class.name.demodulize.underscore}-#{object.id}.#{timestamp.strftime("%Y%m%d%H%M%S")}"
host = Setting.mail_from.to_s.gsub(%r{^.*@}, '')
host = "#{::Socket.gethostname}.redmine" if host.empty?
"<#{hash}@#{host}>"
diff --git a/app/models/wiki_content.rb b/app/models/wiki_content.rb
index d206be97..372ca836 100644
--- a/app/models/wiki_content.rb
+++ b/app/models/wiki_content.rb
@@ -25,6 +25,11 @@ class WikiContent < ActiveRecord::Base
validates_length_of :comments, :maximum => 255, :allow_nil => true
acts_as_versioned
+
+ def project
+ page.project
+ end
+
class Version
belongs_to :page, :class_name => '::WikiPage', :foreign_key => 'page_id'
belongs_to :author, :class_name => '::User', :foreign_key => 'author_id'
@@ -87,5 +92,4 @@ class WikiContent < ActiveRecord::Base
:conditions => ["wiki_content_id = ? AND version < ?", wiki_content_id, version])
end
end
-
end
diff --git a/app/models/wiki_content_observer.rb b/app/models/wiki_content_observer.rb
new file mode 100644
index 00000000..d9dbe570
--- /dev/null
+++ b/app/models/wiki_content_observer.rb
@@ -0,0 +1,28 @@
+# Redmine - project management software
+# Copyright (C) 2006-2009 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class WikiContentObserver < ActiveRecord::Observer
+ def after_create(wiki_content)
+ Mailer.deliver_wiki_content_added(wiki_content) if Setting.notified_events.include?('wiki_content_added')
+ end
+
+ def after_update(wiki_content)
+ if wiki_content.text_changed?
+ Mailer.deliver_wiki_content_updated(wiki_content) if Setting.notified_events.include?('wiki_content_updated')
+ end
+ end
+end
diff --git a/app/views/mailer/wiki_content_added.text.html.rhtml b/app/views/mailer/wiki_content_added.text.html.rhtml
new file mode 100644
index 00000000..92e368f5
--- /dev/null
+++ b/app/views/mailer/wiki_content_added.text.html.rhtml
@@ -0,0 +1,3 @@
+
<%= l(:mail_body_wiki_content_added, :page => link_to(h(@wiki_content.page.pretty_title), @wiki_content_url),
+ :author => h(@wiki_content.author)) %>
+<%=h @wiki_content.comments %>
diff --git a/app/views/mailer/wiki_content_added.text.plain.rhtml b/app/views/mailer/wiki_content_added.text.plain.rhtml
new file mode 100644
index 00000000..5699eecd
--- /dev/null
+++ b/app/views/mailer/wiki_content_added.text.plain.rhtml
@@ -0,0 +1,5 @@
+<%= l(:mail_body_wiki_content_added, :page => h(@wiki_content.page.pretty_title),
+ :author => h(@wiki_content.author)) %>
+<%= @wiki_content.comments %>
+
+<%= @wiki_content_url %>
diff --git a/app/views/mailer/wiki_content_updated.text.html.rhtml b/app/views/mailer/wiki_content_updated.text.html.rhtml
new file mode 100644
index 00000000..9f0bf0c8
--- /dev/null
+++ b/app/views/mailer/wiki_content_updated.text.html.rhtml
@@ -0,0 +1,6 @@
+<%= l(:mail_body_wiki_content_updated, :page => link_to(h(@wiki_content.page.pretty_title), @wiki_content_url),
+ :author => h(@wiki_content.author)) %>
+<%=h @wiki_content.comments %>
+
+<%= l(:label_view_diff) %>:
+<%= link_to @wiki_diff_url, @wiki_diff_url %>
diff --git a/app/views/mailer/wiki_content_updated.text.plain.rhtml b/app/views/mailer/wiki_content_updated.text.plain.rhtml
new file mode 100644
index 00000000..29767a65
--- /dev/null
+++ b/app/views/mailer/wiki_content_updated.text.plain.rhtml
@@ -0,0 +1,8 @@
+<%= l(:mail_body_wiki_content_updated, :page => h(@wiki_content.page.pretty_title),
+ :author => h(@wiki_content.author)) %>
+<%= @wiki_content.comments %>
+
+<%= @wiki_content.page.pretty_title %>:
+<%= @wiki_content_url %>
+<%= l(:label_view_diff) %>:
+<%= @wiki_diff_url %>
diff --git a/config/environment.rb b/config/environment.rb
index 826856d1..f98968bc 100644
--- a/config/environment.rb
+++ b/config/environment.rb
@@ -36,7 +36,7 @@ Rails::Initializer.run do |config|
# Activate observers that should always be running
# config.active_record.observers = :cacher, :garbage_collector
- config.active_record.observers = :message_observer, :issue_observer, :journal_observer, :news_observer, :document_observer
+ config.active_record.observers = :message_observer, :issue_observer, :journal_observer, :news_observer, :document_observer, :wiki_content_observer
# Make Active Record use UTC-base instead of local time
# config.active_record.default_timezone = :utc
diff --git a/config/locales/bg.yml b/config/locales/bg.yml
index 47fb305c..36923c83 100644
--- a/config/locales/bg.yml
+++ b/config/locales/bg.yml
@@ -790,3 +790,9 @@ bg:
text_wiki_page_destroy_children: Delete child pages and all their descendants
setting_password_min_length: Minimum password length
field_group_by: Group results by
+ mail_subject_wiki_content_updated: "'{{page}}' wiki page has been updated"
+ label_wiki_content_added: Wiki page added
+ mail_subject_wiki_content_added: "'{{page}}' wiki page has been added"
+ mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}.
+ label_wiki_content_updated: Wiki page updated
+ mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
diff --git a/config/locales/bs.yml b/config/locales/bs.yml
index fe0c30c2..59b25214 100644
--- a/config/locales/bs.yml
+++ b/config/locales/bs.yml
@@ -823,3 +823,9 @@ bs:
text_wiki_page_destroy_children: Delete child pages and all their descendants
setting_password_min_length: Minimum password length
field_group_by: Group results by
+ mail_subject_wiki_content_updated: "'{{page}}' wiki page has been updated"
+ label_wiki_content_added: Wiki page added
+ mail_subject_wiki_content_added: "'{{page}}' wiki page has been added"
+ mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}.
+ label_wiki_content_updated: Wiki page updated
+ mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
diff --git a/config/locales/ca.yml b/config/locales/ca.yml
index b8c84975..20113f97 100644
--- a/config/locales/ca.yml
+++ b/config/locales/ca.yml
@@ -793,3 +793,9 @@ ca:
text_wiki_page_destroy_children: Delete child pages and all their descendants
setting_password_min_length: Minimum password length
field_group_by: Group results by
+ mail_subject_wiki_content_updated: "'{{page}}' wiki page has been updated"
+ label_wiki_content_added: Wiki page added
+ mail_subject_wiki_content_added: "'{{page}}' wiki page has been added"
+ mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}.
+ label_wiki_content_updated: Wiki page updated
+ mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
diff --git a/config/locales/cs.yml b/config/locales/cs.yml
index 077cd1ba..a8040ca1 100644
--- a/config/locales/cs.yml
+++ b/config/locales/cs.yml
@@ -796,3 +796,9 @@ cs:
text_wiki_page_destroy_children: Delete child pages and all their descendants
setting_password_min_length: Minimum password length
field_group_by: Group results by
+ mail_subject_wiki_content_updated: "'{{page}}' wiki page has been updated"
+ label_wiki_content_added: Wiki page added
+ mail_subject_wiki_content_added: "'{{page}}' wiki page has been added"
+ mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}.
+ label_wiki_content_updated: Wiki page updated
+ mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
diff --git a/config/locales/da.yml b/config/locales/da.yml
index fb47fb79..6ce2fecb 100644
--- a/config/locales/da.yml
+++ b/config/locales/da.yml
@@ -823,3 +823,9 @@ da:
text_wiki_page_destroy_children: Delete child pages and all their descendants
setting_password_min_length: Minimum password length
field_group_by: Group results by
+ mail_subject_wiki_content_updated: "'{{page}}' wiki page has been updated"
+ label_wiki_content_added: Wiki page added
+ mail_subject_wiki_content_added: "'{{page}}' wiki page has been added"
+ mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}.
+ label_wiki_content_updated: Wiki page updated
+ mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
diff --git a/config/locales/de.yml b/config/locales/de.yml
index 278586af..26855bfd 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -822,3 +822,9 @@ de:
text_wiki_page_destroy_children: Delete child pages and all their descendants
setting_password_min_length: Minimum password length
field_group_by: Group results by
+ mail_subject_wiki_content_updated: "'{{page}}' wiki page has been updated"
+ label_wiki_content_added: Wiki page added
+ mail_subject_wiki_content_added: "'{{page}}' wiki page has been added"
+ mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}.
+ label_wiki_content_updated: Wiki page updated
+ mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
diff --git a/config/locales/en.yml b/config/locales/en.yml
index cdc505a5..3cfcbc66 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -149,6 +149,10 @@ en:
mail_body_account_activation_request: "A new user ({{value}}) has registered. The account is pending your approval:"
mail_subject_reminder: "{{count}} issue(s) due in the next days"
mail_body_reminder: "{{count}} issue(s) that are assigned to you are due in the next {{days}} days:"
+ mail_subject_wiki_content_added: "'{{page}}' wiki page has been added"
+ mail_body_wiki_content_added: "The '{{page}}' wiki page has been added by {{author}}."
+ mail_subject_wiki_content_updated: "'{{page}}' wiki page has been updated"
+ mail_body_wiki_content_updated: "The '{{page}}' wiki page has been updated by {{author}}."
gui_validation_error: 1 error
gui_validation_error_plural: "{{count}} errors"
@@ -670,6 +674,8 @@ en:
label_ascending: Ascending
label_descending: Descending
label_date_from_to: From {{start}} to {{end}}
+ label_wiki_content_added: Wiki page added
+ label_wiki_content_updated: Wiki page updated
button_login: Login
button_submit: Submit
diff --git a/config/locales/es.yml b/config/locales/es.yml
index 812a8059..ff61e7d9 100644
--- a/config/locales/es.yml
+++ b/config/locales/es.yml
@@ -843,3 +843,9 @@ es:
text_wiki_page_destroy_children: Delete child pages and all their descendants
setting_password_min_length: Minimum password length
field_group_by: Group results by
+ mail_subject_wiki_content_updated: "'{{page}}' wiki page has been updated"
+ label_wiki_content_added: Wiki page added
+ mail_subject_wiki_content_added: "'{{page}}' wiki page has been added"
+ mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}.
+ label_wiki_content_updated: Wiki page updated
+ mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
diff --git a/config/locales/fi.yml b/config/locales/fi.yml
index b988ef39..a1cf5cbe 100644
--- a/config/locales/fi.yml
+++ b/config/locales/fi.yml
@@ -833,3 +833,9 @@ fi:
text_wiki_page_destroy_children: Delete child pages and all their descendants
setting_password_min_length: Minimum password length
field_group_by: Group results by
+ mail_subject_wiki_content_updated: "'{{page}}' wiki page has been updated"
+ label_wiki_content_added: Wiki page added
+ mail_subject_wiki_content_added: "'{{page}}' wiki page has been added"
+ mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}.
+ label_wiki_content_updated: Wiki page updated
+ mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index e4d47101..bbe18dca 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -181,6 +181,10 @@ fr:
mail_body_account_activation_request: "Un nouvel utilisateur ({{value}}) s'est inscrit. Son compte nécessite votre approbation:"
mail_subject_reminder: "{{count}} demande(s) arrivent à échéance"
mail_body_reminder: "{{count}} demande(s) qui vous sont assignées arrivent à échéance dans les {{days}} prochains jours:"
+ mail_subject_wiki_content_added: "Page wiki '{{page}}' ajoutée"
+ mail_body_wiki_content_added: "La page wiki '{{page}}' a été ajoutée par {{author}}."
+ mail_subject_wiki_content_updated: "Page wiki '{{page}}' mise à jour"
+ mail_body_wiki_content_updated: "La page wiki '{{page}}' a été mise à jour par {{author}}."
gui_validation_error: 1 erreur
gui_validation_error_plural: "{{count}} erreurs"
@@ -700,6 +704,8 @@ fr:
label_ascending: Croissant
label_descending: Décroissant
label_date_from_to: Du {{start}} au {{end}}
+ label_wiki_content_added: Page wiki ajoutée
+ label_wiki_content_updated: Page wiki mise à jour
button_login: Connexion
button_submit: Soumettre
diff --git a/config/locales/gl.yml b/config/locales/gl.yml
index 08fe8f56..167310e4 100644
--- a/config/locales/gl.yml
+++ b/config/locales/gl.yml
@@ -822,3 +822,9 @@ gl:
text_wiki_page_destroy_children: Delete child pages and all their descendants
setting_password_min_length: Minimum password length
field_group_by: Group results by
+ mail_subject_wiki_content_updated: "'{{page}}' wiki page has been updated"
+ label_wiki_content_added: Wiki page added
+ mail_subject_wiki_content_added: "'{{page}}' wiki page has been added"
+ mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}.
+ label_wiki_content_updated: Wiki page updated
+ mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
diff --git a/config/locales/he.yml b/config/locales/he.yml
index 8e617286..a720e4c2 100644
--- a/config/locales/he.yml
+++ b/config/locales/he.yml
@@ -805,3 +805,9 @@ he:
text_wiki_page_destroy_children: Delete child pages and all their descendants
setting_password_min_length: Minimum password length
field_group_by: Group results by
+ mail_subject_wiki_content_updated: "'{{page}}' wiki page has been updated"
+ label_wiki_content_added: Wiki page added
+ mail_subject_wiki_content_added: "'{{page}}' wiki page has been added"
+ mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}.
+ label_wiki_content_updated: Wiki page updated
+ mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
diff --git a/config/locales/hu.yml b/config/locales/hu.yml
index 117d0f78..2e0b8043 100644
--- a/config/locales/hu.yml
+++ b/config/locales/hu.yml
@@ -828,3 +828,9 @@
text_wiki_page_destroy_children: Delete child pages and all their descendants
setting_password_min_length: Minimum password length
field_group_by: Group results by
+ mail_subject_wiki_content_updated: "'{{page}}' wiki page has been updated"
+ label_wiki_content_added: Wiki page added
+ mail_subject_wiki_content_added: "'{{page}}' wiki page has been added"
+ mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}.
+ label_wiki_content_updated: Wiki page updated
+ mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
diff --git a/config/locales/it.yml b/config/locales/it.yml
index f04e61ba..935c3814 100644
--- a/config/locales/it.yml
+++ b/config/locales/it.yml
@@ -808,3 +808,9 @@ it:
text_wiki_page_destroy_children: Delete child pages and all their descendants
setting_password_min_length: Minimum password length
field_group_by: Group results by
+ mail_subject_wiki_content_updated: "'{{page}}' wiki page has been updated"
+ label_wiki_content_added: Wiki page added
+ mail_subject_wiki_content_added: "'{{page}}' wiki page has been added"
+ mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}.
+ label_wiki_content_updated: Wiki page updated
+ mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
diff --git a/config/locales/ja.yml b/config/locales/ja.yml
index 49f57b56..a9024f2e 100644
--- a/config/locales/ja.yml
+++ b/config/locales/ja.yml
@@ -821,3 +821,9 @@ ja:
text_wiki_page_destroy_children: Delete child pages and all their descendants
setting_password_min_length: Minimum password length
field_group_by: Group results by
+ mail_subject_wiki_content_updated: "'{{page}}' wiki page has been updated"
+ label_wiki_content_added: Wiki page added
+ mail_subject_wiki_content_added: "'{{page}}' wiki page has been added"
+ mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}.
+ label_wiki_content_updated: Wiki page updated
+ mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
diff --git a/config/locales/ko.yml b/config/locales/ko.yml
index c9838185..221c524b 100644
--- a/config/locales/ko.yml
+++ b/config/locales/ko.yml
@@ -852,3 +852,9 @@ ko:
text_wiki_page_destroy_children: Delete child pages and all their descendants
setting_password_min_length: Minimum password length
field_group_by: Group results by
+ mail_subject_wiki_content_updated: "'{{page}}' wiki page has been updated"
+ label_wiki_content_added: Wiki page added
+ mail_subject_wiki_content_added: "'{{page}}' wiki page has been added"
+ mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}.
+ label_wiki_content_updated: Wiki page updated
+ mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
diff --git a/config/locales/lt.yml b/config/locales/lt.yml
index fdc978b7..7ba666e1 100644
--- a/config/locales/lt.yml
+++ b/config/locales/lt.yml
@@ -833,3 +833,9 @@ lt:
text_wiki_page_destroy_children: Delete child pages and all their descendants
setting_password_min_length: Minimum password length
field_group_by: Group results by
+ mail_subject_wiki_content_updated: "'{{page}}' wiki page has been updated"
+ label_wiki_content_added: Wiki page added
+ mail_subject_wiki_content_added: "'{{page}}' wiki page has been added"
+ mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}.
+ label_wiki_content_updated: Wiki page updated
+ mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
diff --git a/config/locales/nl.yml b/config/locales/nl.yml
index cf16950e..00229a81 100644
--- a/config/locales/nl.yml
+++ b/config/locales/nl.yml
@@ -778,3 +778,9 @@ nl:
text_wiki_page_destroy_children: Delete child pages and all their descendants
setting_password_min_length: Minimum password length
field_group_by: Group results by
+ mail_subject_wiki_content_updated: "'{{page}}' wiki page has been updated"
+ label_wiki_content_added: Wiki page added
+ mail_subject_wiki_content_added: "'{{page}}' wiki page has been added"
+ mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}.
+ label_wiki_content_updated: Wiki page updated
+ mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
diff --git a/config/locales/no.yml b/config/locales/no.yml
index 04b618ac..ed9309eb 100644
--- a/config/locales/no.yml
+++ b/config/locales/no.yml
@@ -795,3 +795,9 @@
text_wiki_page_destroy_children: Delete child pages and all their descendants
setting_password_min_length: Minimum password length
field_group_by: Group results by
+ mail_subject_wiki_content_updated: "'{{page}}' wiki page has been updated"
+ label_wiki_content_added: Wiki page added
+ mail_subject_wiki_content_added: "'{{page}}' wiki page has been added"
+ mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}.
+ label_wiki_content_updated: Wiki page updated
+ mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
diff --git a/config/locales/pl.yml b/config/locales/pl.yml
index 49d7ec7d..1a20ffa4 100644
--- a/config/locales/pl.yml
+++ b/config/locales/pl.yml
@@ -826,3 +826,9 @@ pl:
text_wiki_page_destroy_children: Delete child pages and all their descendants
setting_password_min_length: Minimum password length
field_group_by: Group results by
+ mail_subject_wiki_content_updated: "'{{page}}' wiki page has been updated"
+ label_wiki_content_added: Wiki page added
+ mail_subject_wiki_content_added: "'{{page}}' wiki page has been added"
+ mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}.
+ label_wiki_content_updated: Wiki page updated
+ mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml
index e8de22fb..6592f6ce 100644
--- a/config/locales/pt-BR.yml
+++ b/config/locales/pt-BR.yml
@@ -828,3 +828,9 @@ pt-BR:
text_wiki_page_destroy_children: Delete child pages and all their descendants
setting_password_min_length: Minimum password length
field_group_by: Group results by
+ mail_subject_wiki_content_updated: "'{{page}}' wiki page has been updated"
+ label_wiki_content_added: Wiki page added
+ mail_subject_wiki_content_added: "'{{page}}' wiki page has been added"
+ mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}.
+ label_wiki_content_updated: Wiki page updated
+ mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
diff --git a/config/locales/pt.yml b/config/locales/pt.yml
index e43609be..ffc2795d 100644
--- a/config/locales/pt.yml
+++ b/config/locales/pt.yml
@@ -814,3 +814,9 @@ pt:
text_wiki_page_destroy_children: Delete child pages and all their descendants
setting_password_min_length: Minimum password length
field_group_by: Group results by
+ mail_subject_wiki_content_updated: "'{{page}}' wiki page has been updated"
+ label_wiki_content_added: Wiki page added
+ mail_subject_wiki_content_added: "'{{page}}' wiki page has been added"
+ mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}.
+ label_wiki_content_updated: Wiki page updated
+ mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
diff --git a/config/locales/ro.yml b/config/locales/ro.yml
index 31bcf70f..7e5f098f 100644
--- a/config/locales/ro.yml
+++ b/config/locales/ro.yml
@@ -793,3 +793,9 @@ ro:
text_wiki_page_destroy_children: Delete child pages and all their descendants
setting_password_min_length: Minimum password length
field_group_by: Group results by
+ mail_subject_wiki_content_updated: "'{{page}}' wiki page has been updated"
+ label_wiki_content_added: Wiki page added
+ mail_subject_wiki_content_added: "'{{page}}' wiki page has been added"
+ mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}.
+ label_wiki_content_updated: Wiki page updated
+ mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
diff --git a/config/locales/ru.yml b/config/locales/ru.yml
index e55699a8..8b0605bb 100644
--- a/config/locales/ru.yml
+++ b/config/locales/ru.yml
@@ -920,3 +920,9 @@ ru:
text_wiki_page_destroy_children: Delete child pages and all their descendants
setting_password_min_length: Minimum password length
field_group_by: Group results by
+ mail_subject_wiki_content_updated: "'{{page}}' wiki page has been updated"
+ label_wiki_content_added: Wiki page added
+ mail_subject_wiki_content_added: "'{{page}}' wiki page has been added"
+ mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}.
+ label_wiki_content_updated: Wiki page updated
+ mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
diff --git a/config/locales/sk.yml b/config/locales/sk.yml
index 722ee545..dd23496b 100644
--- a/config/locales/sk.yml
+++ b/config/locales/sk.yml
@@ -794,3 +794,9 @@ sk:
text_wiki_page_destroy_children: Delete child pages and all their descendants
setting_password_min_length: Minimum password length
field_group_by: Group results by
+ mail_subject_wiki_content_updated: "'{{page}}' wiki page has been updated"
+ label_wiki_content_added: Wiki page added
+ mail_subject_wiki_content_added: "'{{page}}' wiki page has been added"
+ mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}.
+ label_wiki_content_updated: Wiki page updated
+ mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
diff --git a/config/locales/sl.yml b/config/locales/sl.yml
index becf2c62..f3f4d2fa 100644
--- a/config/locales/sl.yml
+++ b/config/locales/sl.yml
@@ -792,3 +792,9 @@ sl:
text_wiki_page_destroy_children: Delete child pages and all their descendants
setting_password_min_length: Minimum password length
field_group_by: Group results by
+ mail_subject_wiki_content_updated: "'{{page}}' wiki page has been updated"
+ label_wiki_content_added: Wiki page added
+ mail_subject_wiki_content_added: "'{{page}}' wiki page has been added"
+ mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}.
+ label_wiki_content_updated: Wiki page updated
+ mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
diff --git a/config/locales/sr.yml b/config/locales/sr.yml
index d29b83fb..ed56fda9 100644
--- a/config/locales/sr.yml
+++ b/config/locales/sr.yml
@@ -816,3 +816,9 @@
text_wiki_page_destroy_children: Delete child pages and all their descendants
setting_password_min_length: Minimum password length
field_group_by: Group results by
+ mail_subject_wiki_content_updated: "'{{page}}' wiki page has been updated"
+ label_wiki_content_added: Wiki page added
+ mail_subject_wiki_content_added: "'{{page}}' wiki page has been added"
+ mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}.
+ label_wiki_content_updated: Wiki page updated
+ mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
diff --git a/config/locales/sv.yml b/config/locales/sv.yml
index be8b5890..3a7add90 100644
--- a/config/locales/sv.yml
+++ b/config/locales/sv.yml
@@ -850,3 +850,9 @@ sv:
text_wiki_page_destroy_children: Delete child pages and all their descendants
setting_password_min_length: Minimum password length
field_group_by: Group results by
+ mail_subject_wiki_content_updated: "'{{page}}' wiki page has been updated"
+ label_wiki_content_added: Wiki page added
+ mail_subject_wiki_content_added: "'{{page}}' wiki page has been added"
+ mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}.
+ label_wiki_content_updated: Wiki page updated
+ mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
diff --git a/config/locales/th.yml b/config/locales/th.yml
index 56382db2..a2468270 100644
--- a/config/locales/th.yml
+++ b/config/locales/th.yml
@@ -793,3 +793,9 @@ th:
text_wiki_page_destroy_children: Delete child pages and all their descendants
setting_password_min_length: Minimum password length
field_group_by: Group results by
+ mail_subject_wiki_content_updated: "'{{page}}' wiki page has been updated"
+ label_wiki_content_added: Wiki page added
+ mail_subject_wiki_content_added: "'{{page}}' wiki page has been added"
+ mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}.
+ label_wiki_content_updated: Wiki page updated
+ mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
diff --git a/config/locales/tr.yml b/config/locales/tr.yml
index ecfdba74..c167d921 100644
--- a/config/locales/tr.yml
+++ b/config/locales/tr.yml
@@ -829,3 +829,9 @@ tr:
text_wiki_page_destroy_children: Delete child pages and all their descendants
setting_password_min_length: Minimum password length
field_group_by: Group results by
+ mail_subject_wiki_content_updated: "'{{page}}' wiki page has been updated"
+ label_wiki_content_added: Wiki page added
+ mail_subject_wiki_content_added: "'{{page}}' wiki page has been added"
+ mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}.
+ label_wiki_content_updated: Wiki page updated
+ mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
diff --git a/config/locales/uk.yml b/config/locales/uk.yml
index 148642b6..719b2c3f 100644
--- a/config/locales/uk.yml
+++ b/config/locales/uk.yml
@@ -792,3 +792,9 @@ uk:
text_wiki_page_destroy_children: Delete child pages and all their descendants
setting_password_min_length: Minimum password length
field_group_by: Group results by
+ mail_subject_wiki_content_updated: "'{{page}}' wiki page has been updated"
+ label_wiki_content_added: Wiki page added
+ mail_subject_wiki_content_added: "'{{page}}' wiki page has been added"
+ mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}.
+ label_wiki_content_updated: Wiki page updated
+ mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
diff --git a/config/locales/vi.yml b/config/locales/vi.yml
index 7b3238a8..b981752c 100644
--- a/config/locales/vi.yml
+++ b/config/locales/vi.yml
@@ -862,3 +862,9 @@ vi:
text_wiki_page_destroy_children: Delete child pages and all their descendants
setting_password_min_length: Minimum password length
field_group_by: Group results by
+ mail_subject_wiki_content_updated: "'{{page}}' wiki page has been updated"
+ label_wiki_content_added: Wiki page added
+ mail_subject_wiki_content_added: "'{{page}}' wiki page has been added"
+ mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}.
+ label_wiki_content_updated: Wiki page updated
+ mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml
index de037c8e..1c84c993 100644
--- a/config/locales/zh-TW.yml
+++ b/config/locales/zh-TW.yml
@@ -900,3 +900,9 @@
text_wiki_page_destroy_children: Delete child pages and all their descendants
setting_password_min_length: Minimum password length
field_group_by: Group results by
+ mail_subject_wiki_content_updated: "'{{page}}' wiki page has been updated"
+ label_wiki_content_added: Wiki page added
+ mail_subject_wiki_content_added: "'{{page}}' wiki page has been added"
+ mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}.
+ label_wiki_content_updated: Wiki page updated
+ mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index f42975f4..3145d303 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -825,3 +825,9 @@ zh:
text_wiki_page_destroy_children: Delete child pages and all their descendants
setting_password_min_length: Minimum password length
field_group_by: Group results by
+ mail_subject_wiki_content_updated: "'{{page}}' wiki page has been updated"
+ label_wiki_content_added: Wiki page added
+ mail_subject_wiki_content_added: "'{{page}}' wiki page has been added"
+ mail_body_wiki_content_added: The '{{page}}' wiki page has been added by {{author}}.
+ label_wiki_content_updated: Wiki page updated
+ mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
diff --git a/test/unit/wiki_content_test.rb b/test/unit/wiki_content_test.rb
index a8c28ae2..f3f8bc04 100644
--- a/test/unit/wiki_content_test.rb
+++ b/test/unit/wiki_content_test.rb
@@ -40,6 +40,16 @@ class WikiContentTest < Test::Unit::TestCase
assert_equal User.find(1), content.author
assert_equal content.text, content.versions.last.text
end
+
+ def test_create_should_send_email_notification
+ Setting.notified_events = ['wiki_content_added']
+ ActionMailer::Base.deliveries.clear
+ page = WikiPage.new(:wiki => @wiki, :title => "A new page")
+ page.content = WikiContent.new(:text => "Content text", :author => User.find(1), :comments => "My comment")
+ assert page.save
+
+ assert_equal 1, ActionMailer::Base.deliveries.size
+ end
def test_update
content = @page.content
@@ -51,6 +61,16 @@ class WikiContentTest < Test::Unit::TestCase
assert_equal version_count+1, content.versions.length
end
+ def test_update_should_send_email_notification
+ Setting.notified_events = ['wiki_content_updated']
+ ActionMailer::Base.deliveries.clear
+ content = @page.content
+ content.text = "My new content"
+ assert content.save
+
+ assert_equal 1, ActionMailer::Base.deliveries.size
+ end
+
def test_fetch_history
assert !@page.content.versions.empty?
@page.content.versions.each do |version|