fixes #1903: First post of forum topic doesn't show "updated by" message
This commit is contained in:
@@ -19,6 +19,7 @@ class ForumTopic < ActiveRecord::Base
|
|||||||
validates_associated :original_post
|
validates_associated :original_post
|
||||||
validates_inclusion_of :category_id, :in => CATEGORIES.keys
|
validates_inclusion_of :category_id, :in => CATEGORIES.keys
|
||||||
accepts_nested_attributes_for :original_post
|
accepts_nested_attributes_for :original_post
|
||||||
|
after_update :update_orignal_post
|
||||||
|
|
||||||
module CategoryMethods
|
module CategoryMethods
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
@@ -159,4 +160,10 @@ class ForumTopic < ActiveRecord::Base
|
|||||||
def undelete!
|
def undelete!
|
||||||
update_attributes({:is_deleted => false}, :as => CurrentUser.role)
|
update_attributes({:is_deleted => false}, :as => CurrentUser.role)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def update_orignal_post
|
||||||
|
if original_post
|
||||||
|
original_post.update_columns(:updater_id => CurrentUser.id, :updated_at => Time.now)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user