From fbaed1b291d48dc4e4a809f082e8b465efb67b0e Mon Sep 17 00:00:00 2001 From: Edouard Briere Date: Wed, 6 May 2009 21:24:34 +0200 Subject: Add 3 plugin hooks * controller_board_message_new_after_save: hook after creating a new topic, * controller_board_message_reply_after_save: hook after replying to a topic, * controller_wiki_after_save: hook after editing a wiki --- app/controllers/messages_controller.rb | 2 ++ app/controllers/wiki_controller.rb | 1 + 2 files changed, 3 insertions(+), 0 deletions(-) diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 9a7c34c..ddf8682 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -46,6 +46,7 @@ class MessagesController < ApplicationController @message.sticky = params[:message]['sticky'] end if request.post? && @message.save + call_hook(:controller_board_message_new_after_save, { :params => params, :message => @message}) attach_files(@message, params[:attachments]) redirect_to :action => 'show', :id => @message end @@ -58,6 +59,7 @@ class MessagesController < ApplicationController @reply.board = @board @topic.children << @reply if !@reply.new_record? + call_hook(:controller_board_message_reply_after_save, { :params => params, :message => @reply}) attach_files(@reply, params[:attachments]) end redirect_to :action => 'show', :id => @topic diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index 9c62446..8930588 100644 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/wiki_controller.rb @@ -82,6 +82,7 @@ class WikiController < ApplicationController @content.author = User.current # if page is new @page.save will also save content, but not if page isn't a new record if (@page.new_record? ? @page.save : @content.save) + call_hook(:controller_wiki_after_save, { :params => params, :page => @page}) redirect_to :action => 'index', :id => @project, :page => @page.title end end -- 1.6.0.2