From 6d89aa09317719dd4f682f75a10e8e9b50132b5c Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sat, 14 Aug 2010 11:54:20 -0700 Subject: [PATCH] on deleting a notice --- EVENTS.txt | 2 ++ classes/Notice.php | 19 +++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/EVENTS.txt b/EVENTS.txt index bc3e0ea90f..1a3b2594a2 100644 --- a/EVENTS.txt +++ b/EVENTS.txt @@ -1064,3 +1064,5 @@ EndRssEntryArray: at the end of copying a notice to an array - $notice: the notice being copied - &$entry: the entry, with all the fields filled up +NoticeDeleteRelated: at the beginning of deleting related fields to a notice +- $notice: notice being deleted diff --git a/classes/Notice.php b/classes/Notice.php index 0eeebfadf3..686dfc031e 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -121,16 +121,19 @@ class Notice extends Memcached_DataObject $deleted->insert(); } - // Clear related records + if (Event::handle('NoticeDeleteRelated', array($this))) { - $this->clearReplies(); - $this->clearRepeats(); - $this->clearFaves(); - $this->clearTags(); - $this->clearGroupInboxes(); + // Clear related records - // NOTE: we don't clear inboxes - // NOTE: we don't clear queue items + $this->clearReplies(); + $this->clearRepeats(); + $this->clearFaves(); + $this->clearTags(); + $this->clearGroupInboxes(); + + // NOTE: we don't clear inboxes + // NOTE: we don't clear queue items + } $result = parent::delete();