Clear Attentions when notice or profile is removed
This commit is contained in:
parent
bed8cc48bc
commit
5e4a275220
@ -194,8 +194,8 @@ class Notice extends Managed_DataObject
|
|||||||
$this->clearTags();
|
$this->clearTags();
|
||||||
$this->clearGroupInboxes();
|
$this->clearGroupInboxes();
|
||||||
$this->clearFiles();
|
$this->clearFiles();
|
||||||
|
$this->clearAttentions();
|
||||||
|
|
||||||
// NOTE: we don't clear inboxes
|
|
||||||
// NOTE: we don't clear queue items
|
// NOTE: we don't clear queue items
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1910,6 +1910,20 @@ class Notice extends Managed_DataObject
|
|||||||
return $options;
|
return $options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function clearAttentions()
|
||||||
|
{
|
||||||
|
$att = new Attention();
|
||||||
|
$att->notice_id = $this->getID();
|
||||||
|
|
||||||
|
if ($att->find()) {
|
||||||
|
while ($att->fetch()) {
|
||||||
|
// Can't do delete() on the object directly since it won't remove all of it
|
||||||
|
$other = clone($att);
|
||||||
|
$other->delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function clearReplies()
|
function clearReplies()
|
||||||
{
|
{
|
||||||
$replyNotice = new Notice();
|
$replyNotice = new Notice();
|
||||||
|
@ -924,6 +924,7 @@ class Profile extends Managed_DataObject
|
|||||||
$this->_deleteMessages();
|
$this->_deleteMessages();
|
||||||
$this->_deleteTags();
|
$this->_deleteTags();
|
||||||
$this->_deleteBlocks();
|
$this->_deleteBlocks();
|
||||||
|
$this->_deleteAttentions();
|
||||||
Avatar::deleteFromProfile($this, true);
|
Avatar::deleteFromProfile($this, true);
|
||||||
|
|
||||||
// Warning: delete() will run on the batch objects,
|
// Warning: delete() will run on the batch objects,
|
||||||
@ -1025,6 +1026,20 @@ class Profile extends Managed_DataObject
|
|||||||
$block->delete();
|
$block->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _deleteAttentions()
|
||||||
|
{
|
||||||
|
$att = new Attention();
|
||||||
|
$att->profile_id = $this->getID();
|
||||||
|
|
||||||
|
if ($att->find()) {
|
||||||
|
while ($att->fetch()) {
|
||||||
|
// Can't do delete() on the object directly since it won't remove all of it
|
||||||
|
$other = clone($att);
|
||||||
|
$other->delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// XXX: identical to Notice::getLocation.
|
// XXX: identical to Notice::getLocation.
|
||||||
|
|
||||||
public function getLocation()
|
public function getLocation()
|
||||||
|
Loading…
Reference in New Issue
Block a user