Better error handling in Bookmark
This commit is contained in:
parent
67e7bc55ea
commit
3f4d4cb7a0
@ -625,7 +625,11 @@ abstract class ActivityHandlerPlugin extends Plugin
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->showNoticeContent($stored, $out, $scoped);
|
try {
|
||||||
|
$this->showNoticeContent($stored, $out, $scoped);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$out->element('div', 'error', $e->getMessage());
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -379,20 +379,10 @@ class BookmarkPlugin extends MicroAppPlugin
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function showNoticeItemNotice(NoticeListItem $nli)
|
|
||||||
{
|
|
||||||
$nli->out->elementStart('div', 'entry-title');
|
|
||||||
$nli->showAuthor();
|
|
||||||
$nli->showContent();
|
|
||||||
$nli->out->elementEnd('div');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function showNoticeContent(Notice $stored, HTMLOutputter $out, Profile $scoped=null)
|
protected function showNoticeContent(Notice $stored, HTMLOutputter $out, Profile $scoped=null)
|
||||||
{
|
{
|
||||||
$nb = Bookmark::fromStored($stored);
|
$nb = Bookmark::fromStored($stored);
|
||||||
|
|
||||||
$profile = $stored->getProfile();
|
|
||||||
|
|
||||||
// Whether to nofollow
|
// Whether to nofollow
|
||||||
$attrs = array('href' => $nb->getUrl(), 'class' => 'bookmark-title');
|
$attrs = array('href' => $nb->getUrl(), 'class' => 'bookmark-title');
|
||||||
|
|
||||||
@ -405,7 +395,7 @@ class BookmarkPlugin extends MicroAppPlugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
$out->elementStart('h3');
|
$out->elementStart('h3');
|
||||||
$out->element('a', $attrs, $nb->title);
|
$out->element('a', $attrs, $nb->getTitle());
|
||||||
$out->elementEnd('h3');
|
$out->elementEnd('h3');
|
||||||
|
|
||||||
// Replies look like "for:" tags
|
// Replies look like "for:" tags
|
||||||
@ -423,16 +413,14 @@ class BookmarkPlugin extends MicroAppPlugin
|
|||||||
$out->elementStart('ul', array('class' => 'bookmark-tags'));
|
$out->elementStart('ul', array('class' => 'bookmark-tags'));
|
||||||
|
|
||||||
foreach ($replies as $reply) {
|
foreach ($replies as $reply) {
|
||||||
$other = Profile::getKV('id', $reply);
|
$other = Profile::getByPK($reply);
|
||||||
if (!empty($other)) {
|
$out->elementStart('li');
|
||||||
$out->elementStart('li');
|
$out->element('a', array('rel' => 'tag',
|
||||||
$out->element('a', array('rel' => 'tag',
|
'href' => $other->getUrl(),
|
||||||
'href' => $other->profileurl,
|
'title' => $other->getBestName()),
|
||||||
'title' => $other->getBestName()),
|
sprintf('for:%s', $other->getNickname()));
|
||||||
sprintf('for:%s', $other->nickname));
|
$out->elementEnd('li');
|
||||||
$out->elementEnd('li');
|
$out->text(' ');
|
||||||
$out->text(' ');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($tags as $tag) {
|
foreach ($tags as $tag) {
|
||||||
|
Loading…
Reference in New Issue
Block a user