git.gnu.io has moved to IP address 209.51.188.249 -- please double check where you are logging in.

Commit 3c6243ac authored by hannes's avatar hannes

disregard protocol for quoted notices

parent 34519017
......@@ -578,9 +578,14 @@ class QvitterPlugin extends Plugin {
$noticeurl = common_path('notice/', StatusNet::isHTTPS());
$instanceurl = common_path('', StatusNet::isHTTPS());
// remove protocol for the comparison below
$noticeurl_wo_protocol = preg_replace('(^https?://)', '', $noticeurl);
$instanceurl_wo_protocol = preg_replace('(^https?://)', '', $instanceurl);
$attachment_url_wo_protocol = preg_replace('(^https?://)', '', $attachment['url']);
// local notice urls
if(stristr($attachment['url'], $noticeurl)) {
$possible_notice_id = str_replace($noticeurl,'',$attachment['url']);
if(strpos($attachment_url_wo_protocol, $noticeurl_wo_protocol) === 0) {
$possible_notice_id = str_replace($noticeurl_wo_protocol,'',$attachment_url_wo_protocol);
if(ctype_digit($possible_notice_id)) {
$quoted_notice = Notice::getKV('id',$possible_notice_id);;
}
......@@ -588,7 +593,8 @@ class QvitterPlugin extends Plugin {
// remote. but we don't want to lookup every url in the db,
// so only do this if we have reason to believe this might
// be a remote notice url
elseif(!stristr($attachment['url'], $instanceurl) && stristr($attachment['url'],'/notice/')) {
// VERY INEFFICIENT!! maybe index the url column in the notice table?
elseif(strpos($attachment_url_wo_protocol, $instanceurl_wo_protocol) !== 0 && stristr($attachment_url_wo_protocol,'/notice/')) {
$quoted_notice = Notice::getKV('url',$attachment['url']);
}
......
......@@ -91,4 +91,4 @@ for ideas about paths for the API extensions.
Notes
-----
Qvitter is tested with the latest GNU social nightly and also an older version: GNU social version 1.1.1-alpha2 (7e47026085fa4f2071e694d9c3e3fe2aa5142135, 24 aug 2014).
Qvitter is tested with the latest GNU social nightly
......@@ -850,6 +850,13 @@ function searchForUpdatedNoticeData(obj) {
streamItemFoundInFeed.attr('data-attachments',JSON.stringify(obj.attachments));
var attachmentsHTMLBuild = buildAttachmentHTML(obj.attachments);
queetFoundInFeed.find('.queet-thumbs').remove();
queetFoundInFeed.find('.quoted-notices').remove();
// we might want to hide urls (rendered as attachments) in the queet text
$.each(queetFoundInFeed.find('.queet-text').find('a'),function(){
if(attachmentsHTMLBuild.urlsToHide.indexOf($(this).text()) > -1) {
$(this).css('display','none');
}
});
queetFoundInFeed.find('.stream-item-footer').before(attachmentsHTMLBuild.html);
}
......
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