Defect #8992

Unable to access object in WikiMacros in forum topic message

Added by Vitaly Klimov almost 11 years ago.

Status:NewStart date:2011-08-05
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:Forums
Target version:-
Resolution: Affected version:1.2.1

Description

Right now WikiMacro receives nil object if called from main forum message so macro does not have access to files attached to the message.

To fix it in both preview and view modes we should do following:

Fix for view mode

Line 16 of the file app/views/messages/show.rhtml

<%= textilizable(@topic.content, :attachments => @topic.attachments) %>

should be changed to

<%= textilizable(@topic, :content, :attachments => @topic.attachments) %>

Fix in edit mode

Also, to have access to attached files in message preview:

  • Variable @previewed should be set to message in file app/controllers/messages_controller.rb, method preview
  • Hash value :id should be added and set to @message in file app/views/messages/edit.rhtml (line 7):
    { :url => { :controller => 'messages', :action => 'preview', :board_id => @board, :id => @message },
    

Also available in: Atom PDF