DG IZ posts by the user get websocketed on the group page and albums

get signed?
This commit is contained in:
ilya 2010-08-17 18:06:28 -07:00
parent f15b3c46b2
commit daf08cd9f9
3 changed files with 29 additions and 6 deletions

View file

@ -22,6 +22,10 @@ module SocketsHelper
action_hash[:status_message_hash][:mine?] = true if object.person.owner_id == uid action_hash[:status_message_hash][:mine?] = true if object.person.owner_id == uid
end end
if object.person.owner_id == uid
action_hash[:mine?] = true
end
action_hash.to_json action_hash.to_json
end end

View file

@ -3,6 +3,7 @@ class Album
include MongoMapper::Document include MongoMapper::Document
include ROXML include ROXML
include Diaspora::Webhooks include Diaspora::Webhooks
include Encryptable
xml_reader :name xml_reader :name
xml_reader :person, :as => Person xml_reader :person, :as => Person
@ -42,6 +43,24 @@ class Album
p_photo ? p_photo : self.photos.sort(:created_at.desc).last p_photo ? p_photo : self.photos.sort(:created_at.desc).last
end end
#ENCRYPTION
xml_accessor :creator_signature
key :creator_signature, String
def signable_accessors
accessors = self.class.roxml_attrs.collect{|definition|
definition.accessor}
accessors.delete 'person'
accessors.delete 'creator_signature'
accessors
end
def signable_string
signable_accessors.collect{|accessor|
(self.send accessor.to_sym).to_s}.join ';'
end
protected protected
def destroy_photos def destroy_photos
photos.each{|p| p.destroy} photos.each{|p| p.destroy}

View file

@ -23,9 +23,9 @@
}else if (obj['class']=='photos' && onPageForClass('albums')){ }else if (obj['class']=='photos' && onPageForClass('albums')){
processPhotoInAlbum(obj['photo_hash']) processPhotoInAlbum(obj['photo_hash'])
}else if (obj['class']=='status_messages'){ }else if (obj['class']=='status_messages'){
processStatusMessage(obj['class'], obj['html'], obj['status_message_hash'], obj['group_id']) processStatusMessage(obj['class'], obj['html'], obj['status_message_hash'], obj['group_id'], obj['mine?'])
}else{ }else{
processPost(obj['class'], obj['html'], obj['group_id']) processPost(obj['class'], obj['html'], obj['group_id'], obj['mine?'])
} }
@ -52,8 +52,8 @@
toggler.html().replace(/\d/,$('.comment_set', post)[0].childElementCount -1)); toggler.html().replace(/\d/,$('.comment_set', post)[0].childElementCount -1));
} }
function processPost(className, html, groupId){ function processPost(className, html, groupId, mineBool){
if(onPageForClass(className) || onPageForGroup(groupId)){ if(mineBool || onPageForClass(className) || onPageForGroup(groupId)){
$("#stream").prepend( $("#stream").prepend(
$(html).fadeIn("fast", function(){ $(html).fadeIn("fast", function(){
$("#stream label:first").inFieldLabels(); $("#stream label:first").inFieldLabels();
@ -62,8 +62,8 @@
} }
} }
function processStatusMessage(className, html, messageHash, groupId){ function processStatusMessage(className, html, messageHash, groupId, mineBool){
processPost(className, html, groupId); processPost(className, html, groupId, mineBool);
console.log(messageHash) console.log(messageHash)
if(messageHash['mine?']){ if(messageHash['mine?']){
updateMyLatestStatus(messageHash); updateMyLatestStatus(messageHash);