ms dg post deletions now come thru the socket again
This commit is contained in:
parent
ce132dd782
commit
d37461a432
5 changed files with 25 additions and 6 deletions
|
|
@ -13,7 +13,7 @@ class PeopleController < ApplicationController
|
|||
|
||||
def destroy
|
||||
current_user.unfriend(params[:id])
|
||||
flash[:notice] = "Successfully destroyed person."
|
||||
flash[:notice] = "unfriended person."
|
||||
redirect_to people_url
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -8,13 +8,15 @@ class RequestsController < ApplicationController
|
|||
|
||||
def destroy
|
||||
if params[:accept]
|
||||
current_user.accept_friend_request params[:id]
|
||||
@friend = current_user.accept_friend_request params[:id]
|
||||
|
||||
flash[:notice] = "you are now friends"
|
||||
redirect_to root_url
|
||||
else
|
||||
current_user.ignore_friend_request params[:id]
|
||||
flash[:notice] = "ignored friend request"
|
||||
end
|
||||
redirect_to requests_url
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,11 @@ class SocketsController < ApplicationController
|
|||
|
||||
def outgoing(object)
|
||||
@_request = ActionDispatch::Request.new({})
|
||||
|
||||
puts action_hash(object)
|
||||
|
||||
|
||||
|
||||
WebSocket.push_to_clients(action_hash(object))
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ class Retraction
|
|||
retraction = self.new
|
||||
retraction.post_id= object.id
|
||||
retraction.person_id = person_id_from(object)
|
||||
retraction.type = object.class
|
||||
retraction.type = self.type_name(object)
|
||||
retraction
|
||||
end
|
||||
|
||||
|
|
@ -19,7 +19,8 @@ class Retraction
|
|||
attr_accessor :type
|
||||
|
||||
def perform
|
||||
self.type.constantize.delete(self.post_id)
|
||||
puts('GO GO GO')
|
||||
self.type.constantize.destroy(self.post_id)
|
||||
end
|
||||
|
||||
def self.person_id_from(object)
|
||||
|
|
@ -30,4 +31,15 @@ class Retraction
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
def self.type_name(object)
|
||||
if object.is_a? Post
|
||||
object.class
|
||||
elsif object.is_a? User
|
||||
'Person'
|
||||
else
|
||||
'Clowntown'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -4,6 +4,6 @@
|
|||
= "#{request.destination_url}"
|
||||
|
||||
.destroy_link
|
||||
= link_to 'Accept', request_path(request, :accept => true), :confirm => 'Are you sure?', :method => :delete
|
||||
= link_to 'Accept', request_path(request, :accept => true), :method => :delete
|
||||
|
|
||||
= link_to 'Ignore', request_path(request), :confirm => 'Are you sure?', :method => :delete
|
||||
|
|
|
|||
Loading…
Reference in a new issue