OStatus: override source link with the source domain and link to original message
This commit is contained in:
parent
19b03ef797
commit
e51e96d724
|
@ -492,9 +492,10 @@ class NoticeListItem extends Widget
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
||||||
$name = null;
|
$name = $source_name;
|
||||||
$url = null;
|
$url = null;
|
||||||
|
|
||||||
|
if (Event::handle('StartNoticeSourceLink', array($this->notice, &$name, &$url, &$title))) {
|
||||||
$ns = Notice_source::staticGet($this->notice->source);
|
$ns = Notice_source::staticGet($this->notice->source);
|
||||||
|
|
||||||
if ($ns) {
|
if ($ns) {
|
||||||
|
@ -507,15 +508,18 @@ class NoticeListItem extends Widget
|
||||||
$url = $app->source_url;
|
$url = $app->source_url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
Event::handle('EndNoticeSourceLink', array($this->notice, &$name, &$url, &$title));
|
||||||
|
|
||||||
if (!empty($name) && !empty($url)) {
|
if (!empty($name) && !empty($url)) {
|
||||||
$this->out->elementStart('span', 'device');
|
$this->out->elementStart('span', 'device');
|
||||||
$this->out->element('a', array('href' => $url,
|
$this->out->element('a', array('href' => $url,
|
||||||
'rel' => 'external'),
|
'rel' => 'external',
|
||||||
|
'title' => $title),
|
||||||
$name);
|
$name);
|
||||||
$this->out->elementEnd('span');
|
$this->out->elementEnd('span');
|
||||||
} else {
|
} else {
|
||||||
$this->out->element('span', 'device', $source_name);
|
$this->out->element('span', 'device', $name);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -289,4 +289,17 @@ class OStatusPlugin extends Plugin
|
||||||
$action->script(common_path('plugins/OStatus/js/ostatus.js'));
|
$action->script(common_path('plugins/OStatus/js/ostatus.js'));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onStartNoticeSourceLink($notice, &$name, &$url, &$title)
|
||||||
|
{
|
||||||
|
if ($notice->source == 'ostatus') {
|
||||||
|
$bits = parse_url($notice->uri);
|
||||||
|
$domain = $bits['host'];
|
||||||
|
|
||||||
|
$name = $domain;
|
||||||
|
$url = $notice->uri;
|
||||||
|
$title = sprintf(_m("Sent from %s via OStatus"), $domain);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user