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
|
def destroy
|
||||||
current_user.unfriend(params[:id])
|
current_user.unfriend(params[:id])
|
||||||
flash[:notice] = "Successfully destroyed person."
|
flash[:notice] = "unfriended person."
|
||||||
redirect_to people_url
|
redirect_to people_url
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,15 @@ class RequestsController < ApplicationController
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
if params[:accept]
|
if params[:accept]
|
||||||
current_user.accept_friend_request params[:id]
|
@friend = current_user.accept_friend_request params[:id]
|
||||||
|
|
||||||
flash[:notice] = "you are now friends"
|
flash[:notice] = "you are now friends"
|
||||||
|
redirect_to root_url
|
||||||
else
|
else
|
||||||
current_user.ignore_friend_request params[:id]
|
current_user.ignore_friend_request params[:id]
|
||||||
flash[:notice] = "ignored friend request"
|
flash[:notice] = "ignored friend request"
|
||||||
|
redirect_to requests_url
|
||||||
end
|
end
|
||||||
redirect_to requests_url
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,11 @@ class SocketsController < ApplicationController
|
||||||
|
|
||||||
def outgoing(object)
|
def outgoing(object)
|
||||||
@_request = ActionDispatch::Request.new({})
|
@_request = ActionDispatch::Request.new({})
|
||||||
|
|
||||||
|
puts action_hash(object)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
WebSocket.push_to_clients(action_hash(object))
|
WebSocket.push_to_clients(action_hash(object))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ class Retraction
|
||||||
retraction = self.new
|
retraction = self.new
|
||||||
retraction.post_id= object.id
|
retraction.post_id= object.id
|
||||||
retraction.person_id = person_id_from(object)
|
retraction.person_id = person_id_from(object)
|
||||||
retraction.type = object.class
|
retraction.type = self.type_name(object)
|
||||||
retraction
|
retraction
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -19,7 +19,8 @@ class Retraction
|
||||||
attr_accessor :type
|
attr_accessor :type
|
||||||
|
|
||||||
def perform
|
def perform
|
||||||
self.type.constantize.delete(self.post_id)
|
puts('GO GO GO')
|
||||||
|
self.type.constantize.destroy(self.post_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.person_id_from(object)
|
def self.person_id_from(object)
|
||||||
|
|
@ -30,4 +31,15 @@ class Retraction
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,6 @@
|
||||||
= "#{request.destination_url}"
|
= "#{request.destination_url}"
|
||||||
|
|
||||||
.destroy_link
|
.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
|
= link_to 'Ignore', request_path(request), :confirm => 'Are you sure?', :method => :delete
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue