Realtime work in progress: switch makeNoticeData to async -- next we'll load fresh copies from server, maintaining proper language and plugin enhancements.

This commit is contained in:
Brion Vibber 2011-03-14 12:32:39 -07:00
parent ed2d224df5
commit 1e36593a23

View File

@ -163,7 +163,7 @@ RealtimeUpdate = {
return;
}
var noticeItem = RealtimeUpdate.makeNoticeItem(data);
RealtimeUpdate.makeNoticeItem(data, function(noticeItem) {
var noticeItemID = $(noticeItem).attr('id');
var list = $("#notices_primary .notices:first")
@ -207,6 +207,7 @@ RealtimeUpdate = {
SN.U.NoticeReplyTo($('#'+noticeItemID));
SN.U.NoticeWithAttachment($('#'+noticeItemID));
});
},
/**
@ -263,10 +264,11 @@ RealtimeUpdate = {
},
/**
* Builds a notice HTML block from JSON API-style data.
* Builds a notice HTML block from JSON API-style data;
* loads data from server, so runs async.
*
* @param {Object} data: extended JSON API-formatted notice
* @return {String} HTML fragment
* @param {function} callback: function(str) to receive HTML fragment
*
* @fixme this replicates core StatusNet code, making maintenance harder
* @fixme sloppy HTML building (raw concat without escaping)
@ -275,7 +277,7 @@ RealtimeUpdate = {
*
* @access private
*/
makeNoticeItem: function(data)
makeNoticeItem: function(data, callback)
{
if (data.hasOwnProperty('retweeted_status')) {
original = data['retweeted_status'];
@ -342,7 +344,7 @@ RealtimeUpdate = {
ni = ni+"</div>";
ni = ni+"</li>";
return ni;
callback(ni);
},
/**