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
|
||||
belongs_to :person, :class_name => "Person"
|
||||
|
||||
after_save :send_to_view
|
||||
|
||||
|
||||
def ==(other)
|
||||
(self.message == other.message) && (self.person.email == other.person.email)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -21,8 +21,6 @@ class Post
|
|||
|
||||
timestamps!
|
||||
|
||||
after_save :send_to_view
|
||||
|
||||
before_destroy :propagate_retraction
|
||||
after_destroy :destroy_comments, :remove_from_view
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ class Retraction
|
|||
attr_accessor :type
|
||||
|
||||
def perform
|
||||
Rails.logger.debug "Performing retraction for #{object.post_id}"
|
||||
begin
|
||||
return unless signature_valid?
|
||||
Rails.logger.debug("Retracting #{self.type} id: #{self.post_id}")
|
||||
|
|
|
|||
|
|
@ -124,8 +124,8 @@ class User
|
|||
Rails.logger.debug("Receiving object:\n#{object.inspect}")
|
||||
|
||||
if object.is_a? Retraction
|
||||
Rails.logger.debug "Got a retraction for #{object.post_id}"
|
||||
object.perform
|
||||
object.post.unsocket_from_uid self.id
|
||||
object.perform
|
||||
|
||||
elsif object.is_a? Request
|
||||
person = Diaspora::Parser.get_or_create_person_object_from_xml( xml )
|
||||
|
|
@ -141,6 +141,7 @@ class User
|
|||
person.save
|
||||
else
|
||||
Rails.logger.debug("Saving object with success: #{object.save}")
|
||||
object.socket_to_uid id
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -39,18 +39,5 @@ module Diaspora
|
|||
SocketsController.new.outgoing(id, Retraction.for(self))
|
||||
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue