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

Commit 22f75cc3 authored by Evan Prodromou's avatar Evan Prodromou

Update checking notices for bookmarkness

parent ae340ec3
...@@ -292,19 +292,27 @@ class BookmarkPlugin extends MicroAppPlugin ...@@ -292,19 +292,27 @@ 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)) {
$id = (empty($nli->repeat)) ? $nli->notice->id : $nli->repeat->id; if (empty($nb)) {
$class = 'hentry notice bookmark'; $this->log(LOG_INFO, "Notice {$nli->notice->id} has bookmark class but no matching Bookmark record.");
if ($nli->notice->scope != 0 && $nli->notice->scope != 1) { return true;
$class .= ' limited-scope';
}
$nli->out->elementStart('li', array('class' => $class,
'id' => 'notice-' . $id));
Event::handle('EndOpenNoticeListItemElement', array($nli));
return false;
} }
return true;
$id = (empty($nli->repeat)) ? $nli->notice->id : $nli->repeat->id;
$class = 'hentry notice bookmark';
if ($nli->notice->scope != 0 && $nli->notice->scope != 1) {
$class .= ' limited-scope';
}
$nli->out->elementStart('li', array('class' => $class,
'id' => 'notice-' . $id));
Event::handle('EndOpenNoticeListItemElement', array($nli));
return false;
} }
/** /**
...@@ -355,12 +363,15 @@ class BookmarkPlugin extends MicroAppPlugin ...@@ -355,12 +363,15 @@ class BookmarkPlugin extends MicroAppPlugin
*/ */
function deleteRelated($notice) function deleteRelated($notice)
{ {
$nb = Bookmark::getByNotice($notice); if ($this->isMyNotice($notice)) {
if (!empty($nb)) { $nb = Bookmark::getByNotice($notice);
$nb->delete();
} if (!empty($nb)) {
$nb->delete();
}
}
return true; return true;
} }
......
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