// @fixme we have some cases where things get re-run and so the
// insert fails.
$deleted = Deleted_notice::staticGet('id', $this->id);
+
+ if (!$deleted) {
+ $deleted = Deleted_notice::staticGet('uri', $this->uri);
+ }
+
if (!$deleted) {
$deleted = new Deleted_notice();
$this->clearFaves();
$this->clearTags();
$this->clearGroupInboxes();
+ $this->clearFiles();
// NOTE: we don't clear inboxes
// NOTE: we don't clear queue items
// Exclude any deleted, non-local, or blocking recipients.
$profile = $this->getProfile();
+ $originalProfile = null;
+ if ($this->repeat_of) {
+ // Check blocks against the original notice's poster as well.
+ $original = Notice::staticGet('id', $this->repeat_of);
+ if ($original) {
+ $originalProfile = $original->getProfile();
+ }
+ }
foreach ($ni as $id => $source) {
$user = User::staticGet('id', $id);
- if (empty($user) || $user->hasBlocked($profile)) {
+ if (empty($user) || $user->hasBlocked($profile) ||
+ ($originalProfile && $user->hasBlocked($originalProfile))) {
unset($ni[$id]);
}
}
$reply->free();
}
+ function clearFiles()
+ {
+ $f2p = new File_to_post();
+
+ $f2p->post_id = $this->id;
+
+ if ($f2p->find()) {
+ while ($f2p->fetch()) {
+ $f2p->delete();
+ }
+ }
+ // FIXME: decide whether to delete File objects
+ // ...and related (actual) files
+ }
+
function clearRepeats()
{
$repeatNotice = new Notice();