Skip to content
Extraits de code Groupes Projets
Valider f15b3c46 rédigé par ilya's avatar ilya
Parcourir les fichiers

DG IZ; reverted to before removing latest message methods

parent 054dafdf
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -17,9 +17,9 @@ module SocketsHelper ...@@ -17,9 +17,9 @@ module SocketsHelper
if object.is_a? Photo if object.is_a? Photo
action_hash[:photo_hash] = object.thumb_hash action_hash[:photo_hash] = object.thumb_hash
end elsif object.is_a? StatusMessage
if object.person.owner_id == uid action_hash[:status_message_hash] = object.latest_hash
acton_hash[:mine?] == true action_hash[:status_message_hash][:mine?] = true if object.person.owner_id == uid
end end
action_hash.to_json action_hash.to_json
......
...@@ -21,5 +21,8 @@ class StatusMessage < Post ...@@ -21,5 +21,8 @@ class StatusMessage < Post
XML XML
end end
def latest_hash
{ :text => message}
end
end end
...@@ -12,8 +12,7 @@ ...@@ -12,8 +12,7 @@
//Attach onmessage to websocket //Attach onmessage to websocket
ws.onmessage = function(evt) { ws.onmessage = function(evt) {
var obj = jQuery.parseJSON(evt.data); var obj = jQuery.parseJSON(evt.data);
debug("got a " + obj['class'] ); debug("got a " + obj['class'] + " for group " + obj['group_id']);
if (obj['class']=="retractions"){ if (obj['class']=="retractions"){
processRetraction(obj['post_id']); processRetraction(obj['post_id']);
...@@ -23,11 +22,10 @@ ...@@ -23,11 +22,10 @@
}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'){
processStatusMessage(obj['class'], obj['html'], obj['status_message_hash'], obj['group_id'])
}else{ }else{
if( (obj['mine?'])|| (onPageForClass(obj['class']) || onPageForGroup(obj['group_id'])) ){ processPost(obj['class'], obj['html'], obj['group_id'])
processPost(obj['class'], obj['html'])
}
} }
...@@ -64,6 +62,14 @@ ...@@ -64,6 +62,14 @@
} }
} }
function processStatusMessage(className, html, messageHash, groupId){
processPost(className, html, groupId);
console.log(messageHash)
if(messageHash['mine?']){
updateMyLatestStatus(messageHash);
}
}
function updateMyLatestStatus(messageHash){ function updateMyLatestStatus(messageHash){
$("#latest_message").text(messageHash['text']); $("#latest_message").text(messageHash['text']);
$("#latest_message_time").text(' - just now'); $("#latest_message_time").text(' - just now');
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter