Also fixed the bug with images not displaying if received via a delta update...

Also fixed the bug with images not displaying if received via a delta update for the All Friends timeline.
parent 6fb503dc
......@@ -12,6 +12,25 @@ function insertAfter(parentNode, referenceNode, newNode) {
parentNode.insertBefore(newNode, nodeToInsertBefore);
}
function massageAssetURLsInMessages(messages){
// Massage the asset URLs
var massagedMessages = [];
messages.forEach(function (message){
// Replace asset URLs
var personHandleDelimeter = message.key.lastIndexOf('Z-');
if (personHandleDelimeter != -1) {
var personHandle = message.key.substr(personHandleDelimeter+2);
message.value = message.value.replace(new RegExp('/all-friends/to', 'g'), "http://127.0.0.1:42003/all-friends/from/"+personHandle);
}
massagedMessages.push(message);
});
return messages;
}
function getOlderMessages(){
console.log("Polling server for older public posts (infinite scroll)…")
......@@ -57,6 +76,8 @@ function getOlderMessages(){
return;
}
posts = massageAssetURLsInMessages(posts);
console.log("Got " + posts.length + "older posts.");
var repeaterNodeInnerHTML =
......@@ -134,7 +155,7 @@ function getOlderMessages(){
return 'No date.';
}
}
set.format['timestampFormatter'] = function (messageID) {
var messageIDParserRegExp = /^(\d{9})?-?(\d{4}-\d{2}-\d{2}T\d{2}_\d{2}_\d{2}\.\d{3}Z)-?(.*)?/
......@@ -319,6 +340,8 @@ window.addEventListener('load', function(){
return;
}
posts = massageAssetURLsInMessages(posts);
// Make sure that the notice is hidden and that the main section is showing.
// (Set can’t handle this automatically as we are not running it on the
// entire document but only on the delta repeat block below for performance reasons.)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment