app/controllers/thredded/posts_controller.rb in thredded-0.11.0 vs app/controllers/thredded/posts_controller.rb in thredded-0.11.1
- old
+ new
@@ -17,10 +17,12 @@
redirect_to post_path(post, user: thredded_current_user)
end
def edit
authorize post, :update?
+ return redirect_to(canonical_topic_params) unless params_match?(canonical_topic_params)
+ render
end
def update
authorize post, :update?
post.update_attributes(post_params.except(:user, :ip))
@@ -42,9 +44,13 @@
post.mark_as_unread(thredded_current_user, page)
after_mark_as_unread # customization hook
end
private
+
+ def canonical_topic_params
+ { messageboard_id: messageboard.slug, topic_id: topic.slug }
+ end
def after_mark_as_unread
redirect_to messageboard_topics_path(messageboard)
end