Update checking notices for bookmarkness
This commit is contained in:
parent
ae340ec345
commit
22f75cc352
|
@ -292,8 +292,17 @@ class BookmarkPlugin extends MicroAppPlugin
|
||||||
|
|
||||||
function onStartOpenNoticeListItemElement($nli)
|
function onStartOpenNoticeListItemElement($nli)
|
||||||
{
|
{
|
||||||
|
if (!$this->isMyNotice($nli->notice)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
$nb = Bookmark::getByNotice($nli->notice);
|
$nb = Bookmark::getByNotice($nli->notice);
|
||||||
if (!empty($nb)) {
|
|
||||||
|
if (empty($nb)) {
|
||||||
|
$this->log(LOG_INFO, "Notice {$nli->notice->id} has bookmark class but no matching Bookmark record.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
$id = (empty($nli->repeat)) ? $nli->notice->id : $nli->repeat->id;
|
$id = (empty($nli->repeat)) ? $nli->notice->id : $nli->repeat->id;
|
||||||
$class = 'hentry notice bookmark';
|
$class = 'hentry notice bookmark';
|
||||||
if ($nli->notice->scope != 0 && $nli->notice->scope != 1) {
|
if ($nli->notice->scope != 0 && $nli->notice->scope != 1) {
|
||||||
|
@ -301,11 +310,10 @@ class BookmarkPlugin extends MicroAppPlugin
|
||||||
}
|
}
|
||||||
$nli->out->elementStart('li', array('class' => $class,
|
$nli->out->elementStart('li', array('class' => $class,
|
||||||
'id' => 'notice-' . $id));
|
'id' => 'notice-' . $id));
|
||||||
|
|
||||||
Event::handle('EndOpenNoticeListItemElement', array($nli));
|
Event::handle('EndOpenNoticeListItemElement', array($nli));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save a remote bookmark (from Salmon or PuSH)
|
* Save a remote bookmark (from Salmon or PuSH)
|
||||||
|
@ -355,11 +363,14 @@ class BookmarkPlugin extends MicroAppPlugin
|
||||||
*/
|
*/
|
||||||
function deleteRelated($notice)
|
function deleteRelated($notice)
|
||||||
{
|
{
|
||||||
|
if ($this->isMyNotice($notice)) {
|
||||||
|
|
||||||
$nb = Bookmark::getByNotice($notice);
|
$nb = Bookmark::getByNotice($notice);
|
||||||
|
|
||||||
if (!empty($nb)) {
|
if (!empty($nb)) {
|
||||||
$nb->delete();
|
$nb->delete();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user