New User Education goes through a server side ComposerMessages check. Composer message for users

who don't have avatars.
This commit is contained in:
Robin Ward
2013-09-12 17:46:43 -04:00
parent 32163bc356
commit 7d9a84b496
16 changed files with 356 additions and 109 deletions

View File

@ -0,0 +1,13 @@
require_dependency 'composer_messages_finder'
class ComposerMessagesController < ApplicationController
before_filter :ensure_logged_in
def index
finder = ComposerMessagesFinder.new(current_user, params.slice(:composerAction, :topic_id, :post_id))
render_json_dump([finder.find].compact)
end
end

View File

@ -1,25 +0,0 @@
class EducationController < ApplicationController
before_filter :ensure_logged_in
def show
raise Discourse::InvalidAccess.new unless params[:id] =~ /^[a-z0-9\-\_]+$/
raise Discourse::NotFound.new if I18n.t("education.#{params[:id]}", default: MISSING_KEY) == MISSING_KEY
education_posts_text = I18n.t('education.until_posts', count: SiteSetting.educate_until_posts)
markdown_content = ""
if params[:id] == 'new-topic'
markdown_content = SiteContent.content_for(:education_new_topic, education_posts_text: education_posts_text)
else
markdown_content = SiteContent.content_for(:education_new_reply, education_posts_text: education_posts_text)
end
render text: PrettyText.cook(markdown_content)
end
private
MISSING_KEY = '_MISSING_KEY_'.freeze
end

View File

@ -177,11 +177,6 @@ class PostsController < ApplicationController
render_serialized(post.replies, PostSerializer)
end
# Returns the "you're creating a post education"
def education_text
end
def bookmark
post = find_post_from_params
if current_user