Merge branch 'master' of github.com:diaspora/diaspora_rails
This commit is contained in:
commit
72559cbce1
4 changed files with 13 additions and 17 deletions
|
|
@ -4,14 +4,10 @@ module SocketsHelper
|
|||
def obj_id(object)
|
||||
(object.is_a? Post) ? object.id : object.post_id
|
||||
end
|
||||
|
||||
#def url_options
|
||||
# {:host => ""}
|
||||
#end
|
||||
|
||||
def action_hash(uid, object)
|
||||
begin
|
||||
user = User.first(:id => uid)
|
||||
user = User.find_by_id(uid)
|
||||
v = render_to_string(:partial => type_partial(object), :locals => {:post => object, :current_user => user}) unless object.is_a? Retraction
|
||||
rescue Exception => e
|
||||
Rails.logger.error("web socket view rendering failed for object #{object.inspect}.")
|
||||
|
|
|
|||
|
|
@ -59,16 +59,7 @@ class Person
|
|||
end
|
||||
|
||||
|
||||
######## Posting ########
|
||||
def post(class_name, options = {})
|
||||
options[:person] = self
|
||||
model_class = class_name.to_s.camelize.constantize
|
||||
post = model_class.instantiate(options)
|
||||
post.creator_signature = post.sign_with_key(encryption_key)
|
||||
post.notify_people
|
||||
post.socket_to_uid owner.id if (owner_id && post.respond_to?( :socket_to_uid))
|
||||
post
|
||||
end
|
||||
|
||||
|
||||
######## Commenting ########
|
||||
def comment(text, options = {})
|
||||
|
|
|
|||
|
|
@ -37,7 +37,17 @@ class User
|
|||
Group.create(opts)
|
||||
end
|
||||
|
||||
######### Posts and Such ###############
|
||||
######## Posting ########
|
||||
def post(class_name, options = {})
|
||||
options[:person] = self.person
|
||||
model_class = class_name.to_s.camelize.constantize
|
||||
post = model_class.instantiate(options)
|
||||
post.creator_signature = post.sign_with_key(encryption_key)
|
||||
post.notify_people
|
||||
post.socket_to_uid owner.id if (owner_id && post.respond_to?( :socket_to_uid))
|
||||
post
|
||||
end ######### Posts and Such ###############
|
||||
|
||||
def retract( post )
|
||||
retraction = Retraction.for(post)
|
||||
retraction.creator_signature = retraction.sign_with_key( encryption_key )
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ describe 'SocketsController' do
|
|||
before do
|
||||
@user = Factory.create(:user)
|
||||
SocketsController.unstub!(:new)
|
||||
#EventMachine::WebSocket.stub!(:start)
|
||||
@controller = SocketsController.new
|
||||
@controller.request = mock_model(Request, :env =>
|
||||
{'warden' => mock_model(Warden, :authenticate? => @user, :authenticate! => @user, :authenticate => @user)})
|
||||
|
|
|
|||
Loading…
Reference in a new issue