From cdc1ba4ed8af93ec5e4d82e5aa6bd9d1f7197d6f Mon Sep 17 00:00:00 2001 From: Hannes Mannerheim Date: Mon, 12 May 2014 13:06:32 +0200 Subject: [PATCH] handle the new gnusocial API's URI parameter --- js/dom-functions.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/js/dom-functions.js b/js/dom-functions.js index a5fc6d1..d28e57a 100644 --- a/js/dom-functions.js +++ b/js/dom-functions.js @@ -1104,6 +1104,21 @@ function showConversation(qid) { in_reply_to_screen_name = obj.in_reply_to_screen_name; } + // gnu social don't use url as uri anymore, we need to handle both cases + if(obj.uri.substring(0,4) != 'http') { + + // guess the url if we only have the non-url uri + if(typeof obj.url == 'undefined') { + var httpOrHttps = obj.user.statusnet_profile_url.substring(0,obj.user.statusnet_profile_url.indexOf('://')); + obj.uri = httpOrHttps + '://' + obj.uri.substring(4,obj.uri.indexOf(',')) + '/notice/' + obj.uri.substring(obj.uri.indexOf('noticeId=')+9,obj.uri.indexOf(':objectType')); + } + + // if the new url record is present, use that + else { + obj.uri = obj.url; + } + } + // requeet or delete html var requeetedClass = ''; if(obj.user.id == window.myUserID) {