Permalink
Browse files

Fix text filter settings on editing/autosaving old posts and pages.

  • Loading branch information...
1 parent c051dfc commit 2f864a55e3cb6665b554f953e881f1ba7fda8a66 @Flameeyes committed Feb 17, 2013
Showing with 3 additions and 3 deletions.
  1. +2 −2 app/controllers/admin/content_controller.rb
  2. +1 −1 app/controllers/admin/pages_controller.rb
@@ -86,7 +86,7 @@ def autosave
id = params[:article][:id] if params[:article] && params[:article][:id]
@article = Article.get_or_build_article(id)
- @article.text_filter = current_user.text_filter if current_user.simple_editor?
+ @article.text_filter ||= set_textfilter
get_fresh_or_existing_draft_for_article
@@ -140,7 +140,7 @@ def new_or_edit
id = params[:id]
id = params[:article][:id] if params[:article] && params[:article][:id]
@article = Article.get_or_build_article(id)
- @article.text_filter = set_textfilter
+ @article.text_filter ||= set_textfilter
@post_types = PostType.find(:all)
if request.post?
@@ -17,7 +17,7 @@ def index
def new
@page = Page.new(params[:page])
@page.user_id = current_user.id
- @page.text_filter = set_textfilter
+ @page.text_filter ||= set_textfilter
if request.post?
@page.published_at = Time.now
if @page.save

4 comments on commit 2f864a5

mvz replied Feb 22, 2013

It turns out this breaks the specs pretty badly and actually keeps the text filter at textile unless set through params.

Owner

Flameeyes replied Feb 22, 2013

How does it break it exactly? Besides, I honestly care less about the specs than the actual behaviour. Current master is TFU in this regard, as editing always reset to none.

mvz replied Feb 22, 2013

Article sets text_filter to textile automatically, so the calls to set_textfilter never happen. This will also happen in production, so this means set_textfilter can just be removed.

With failing specs there is nothing to fall back on in development, so I'm not going to merge anything in with specs failing.

Owner

Flameeyes replied Feb 22, 2013

Do as you wish, but know that right now the thing is messed up in production.

Maybe I should just give up on Typo, if specs are more important than behaviour.

Please sign in to comment.