Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix two Topic bugs
1. Deleting only post in a topic led to bad redirect.
   (Reported by Andrew Stacey)
2. Moderators could not create new topics.
  • Loading branch information
distler committed Aug 8, 2011
1 parent e286888 commit 8caf38d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/controllers/posts_controller.rb
Expand Up @@ -76,7 +76,13 @@ def destroy
@post.destroy

respond_to do |format|
format.html { redirect_to(forum_topic_path(@forum, @topic)) }
format.html do
if @forum.topics.exists?(@topic)
redirect_to(forum_topic_path(@forum, @topic))
else
redirect_to(@forum)
end
end
format.xml { head :ok }
end
end
Expand Down
1 change: 1 addition & 0 deletions app/views/topics/_form.html.erb
Expand Up @@ -5,6 +5,7 @@
<%= form.text_field :title, :onchange => "/*TopicForm.editNewTitle(this);*/", :class => "primary", :tabindex => 10 %>
<%= for_moderators_of @forum do %>
<input name="topic[forum_id]" type="hidden" value="<%= @forum.permalink %>" />
<label style="margin-left:1em;">
<%= form.check_box :sticky %> <%= I18n.t('txt.sticky', :default => 'sticky') %>
</label>
Expand Down

0 comments on commit 8caf38d

Please sign in to comment.