diff --git a/app/controllers/sockets_controller.rb b/app/controllers/sockets_controller.rb index 76f2701d3..0689af9d6 100644 --- a/app/controllers/sockets_controller.rb +++ b/app/controllers/sockets_controller.rb @@ -17,7 +17,7 @@ class SocketsController < ApplicationController #this should be the actual params of the controller @params = {:user_or_id => user_or_id, :object => object}.merge(opts) return unless Diaspora::WebSocket.is_connected?(user_id) - @_request = ActionDispatch::Request.new({}) + @_request = SocketRequest.new({}) Diaspora::WebSocket.queue_to_user(user_id, action_hash(user, object, opts)) end @@ -44,4 +44,10 @@ class SocketsController < ApplicationController def all_aspects @all_aspects ||= user.aspects end + + class SocketRequest < ActionDispatch::Request + def format + 'socket' + end + end end diff --git a/app/helpers/comments_helper.rb b/app/helpers/comments_helper.rb index a8edd58ba..a54a1ad3f 100644 --- a/app/helpers/comments_helper.rb +++ b/app/helpers/comments_helper.rb @@ -22,4 +22,12 @@ module CommentsHelper :partial => 'comments/new_comment', :locals => {:post_id => GSUB_THIS, :current_user => current_user}) @form.gsub(GSUB_THIS, post_id.to_s).html_safe end + + def comment_form_wrapper_class(post) + if post.comments.empty? && request && request.format != 'mobile' + 'hidden' + else + nil + end + end end diff --git a/app/views/comments/_comments.haml b/app/views/comments/_comments.haml index 7801ba91b..4d80837c4 100644 --- a/app/views/comments/_comments.haml +++ b/app/views/comments/_comments.haml @@ -14,5 +14,5 @@ = render :partial => 'comments/comment', :collection => post.comments, :locals => {:post => post} - unless @commenting_disabled - .new_comment_form_wrapper{:class => ('hidden' if(post.comments.empty? && request.format !='mobile'))} + .new_comment_form_wrapper{:class => comment_form_wrapper_class(post)} = new_comment_form(post.id, current_user)