Adds email notification on wiki changes (#413). It's disabled by default and can be enabled in application settings.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2749 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
6e0a818caf
commit
9c9dc6e814
|
@ -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|
|
||||
|
|
|
@ -153,6 +153,37 @@ class Mailer < ActionMailer::Base
|
|||
: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.
|
||||
#
|
||||
# Example:
|
||||
|
@ -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}>"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -0,0 +1,3 @@
|
|||
<p><%= l(:mail_body_wiki_content_added, :page => link_to(h(@wiki_content.page.pretty_title), @wiki_content_url),
|
||||
:author => h(@wiki_content.author)) %><br />
|
||||
<em><%=h @wiki_content.comments %></em></p>
|
|
@ -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 %>
|
|
@ -0,0 +1,6 @@
|
|||
<p><%= l(:mail_body_wiki_content_updated, :page => link_to(h(@wiki_content.page.pretty_title), @wiki_content_url),
|
||||
:author => h(@wiki_content.author)) %><br />
|
||||
<em><%=h @wiki_content.comments %></em></p>
|
||||
|
||||
<p><%= l(:label_view_diff) %>:<br />
|
||||
<%= link_to @wiki_diff_url, @wiki_diff_url %></p>
|
|
@ -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 %>
|
|
@ -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
|
||||
|
|
|
@ -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}}.
|
||||
|
|
|
@ -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}}.
|
||||
|
|
|
@ -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}}.
|
||||
|
|
|
@ -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}}.
|
||||
|
|
|
@ -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}}.
|
||||
|
|
|
@ -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}}.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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}}.
|
||||
|
|
|
@ -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}}.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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}}.
|
||||
|
|
|
@ -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}}.
|
||||
|
|
|
@ -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}}.
|
||||
|
|
|
@ -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}}.
|
||||
|
|
|
@ -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}}.
|
||||
|
|
|
@ -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}}.
|
||||
|
|
|
@ -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}}.
|
||||
|
|
|
@ -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}}.
|
||||
|
|
|
@ -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}}.
|
||||
|
|
|
@ -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}}.
|
||||
|
|
|
@ -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}}.
|
||||
|
|
|
@ -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}}.
|
||||
|
|
|
@ -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}}.
|
||||
|
|
|
@ -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}}.
|
||||
|
|
|
@ -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}}.
|
||||
|
|
|
@ -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}}.
|
||||
|
|
|
@ -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}}.
|
||||
|
|
|
@ -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}}.
|
||||
|
|
|
@ -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}}.
|
||||
|
|
|
@ -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}}.
|
||||
|
|
|
@ -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}}.
|
||||
|
|
|
@ -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}}.
|
||||
|
|
|
@ -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}}.
|
||||
|
|
|
@ -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}}.
|
||||
|
|
|
@ -41,6 +41,16 @@ class WikiContentTest < Test::Unit::TestCase
|
|||
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
|
||||
version_count = content.version
|
||||
|
@ -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|
|
||||
|
|
Loading…
Reference in New Issue