RS, DG; Socketing moved to user
This commit is contained in:
parent
0907d7a9fd
commit
2d14f64745
5 changed files with 4 additions and 20 deletions
|
|
@ -19,9 +19,6 @@ class Comment
|
||||||
key :person_id, ObjectId
|
key :person_id, ObjectId
|
||||||
belongs_to :person, :class_name => "Person"
|
belongs_to :person, :class_name => "Person"
|
||||||
|
|
||||||
after_save :send_to_view
|
|
||||||
|
|
||||||
|
|
||||||
def ==(other)
|
def ==(other)
|
||||||
(self.message == other.message) && (self.person.email == other.person.email)
|
(self.message == other.message) && (self.person.email == other.person.email)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,6 @@ class Post
|
||||||
|
|
||||||
timestamps!
|
timestamps!
|
||||||
|
|
||||||
after_save :send_to_view
|
|
||||||
|
|
||||||
before_destroy :propagate_retraction
|
before_destroy :propagate_retraction
|
||||||
after_destroy :destroy_comments, :remove_from_view
|
after_destroy :destroy_comments, :remove_from_view
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ class Retraction
|
||||||
attr_accessor :type
|
attr_accessor :type
|
||||||
|
|
||||||
def perform
|
def perform
|
||||||
|
Rails.logger.debug "Performing retraction for #{object.post_id}"
|
||||||
begin
|
begin
|
||||||
return unless signature_valid?
|
return unless signature_valid?
|
||||||
Rails.logger.debug("Retracting #{self.type} id: #{self.post_id}")
|
Rails.logger.debug("Retracting #{self.type} id: #{self.post_id}")
|
||||||
|
|
|
||||||
|
|
@ -124,8 +124,8 @@ class User
|
||||||
Rails.logger.debug("Receiving object:\n#{object.inspect}")
|
Rails.logger.debug("Receiving object:\n#{object.inspect}")
|
||||||
|
|
||||||
if object.is_a? Retraction
|
if object.is_a? Retraction
|
||||||
Rails.logger.debug "Got a retraction for #{object.post_id}"
|
object.post.unsocket_from_uid self.id
|
||||||
object.perform
|
object.perform
|
||||||
|
|
||||||
elsif object.is_a? Request
|
elsif object.is_a? Request
|
||||||
person = Diaspora::Parser.get_or_create_person_object_from_xml( xml )
|
person = Diaspora::Parser.get_or_create_person_object_from_xml( xml )
|
||||||
|
|
@ -141,6 +141,7 @@ class User
|
||||||
person.save
|
person.save
|
||||||
else
|
else
|
||||||
Rails.logger.debug("Saving object with success: #{object.save}")
|
Rails.logger.debug("Saving object with success: #{object.save}")
|
||||||
|
object.socket_to_uid id
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,18 +39,5 @@ module Diaspora
|
||||||
SocketsController.new.outgoing(id, Retraction.for(self))
|
SocketsController.new.outgoing(id, Retraction.for(self))
|
||||||
end
|
end
|
||||||
|
|
||||||
def send_to_view
|
|
||||||
people_with_permissions.each{|f|
|
|
||||||
socket_to_uid f.owner_id if f.owner_id
|
|
||||||
}
|
|
||||||
socket_to_uid person.owner_id if person.owner_id
|
|
||||||
end
|
|
||||||
|
|
||||||
def remove_from_view
|
|
||||||
people_with_permissions.each{|f|
|
|
||||||
unsocket_from_uid f.owner_id if f.owner_id
|
|
||||||
}
|
|
||||||
unsocket_from_uid person.owner_id if person.owner_id
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue