[ticket/12371] Do not delete post related notifications when a post is deleted

When a post is marked edited and therefor marked as softdeleted/unapproved,
we should not delete the notifications, just like we can't delete the emails.
Links are out there anyway and just keeping the notification is fail save.

If we keep the notification we can just continue to update it when more posts
are added. Also when we delete a post, we don't have to go though the table
and find all related notifications to be able to delete them or even update
them, when they have responders set.

PHPBB3-12371
This commit is contained in:
Joas Schilling 2014-04-11 12:28:14 +02:00
parent e0fadfb4d6
commit 92db22c882
2 changed files with 2 additions and 25 deletions

View file

@ -736,8 +736,6 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =
// Notifications types to delete
$delete_notifications_types = array(
'quote',
'bookmark',
'post',
'approve_post',
'post_in_queue',
);

View file

@ -2272,16 +2272,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
case 'edit_first_post':
case 'edit':
case 'edit_last_post':
if ($data['topic_visibility'] != ITEM_APPROVED)
{
$phpbb_notifications->delete_notifications('topic', $data['topic_id']);
}
$phpbb_notifications->delete_notifications(array(
'quote',
'bookmark',
'post',
), $data['post_id']);
// Nothing to do here
break;
}
}
@ -2292,23 +2283,11 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
case 'post':
case 'reply':
case 'quote':
// Nothing to do here
break;
case 'edit_topic':
case 'edit_first_post':
case 'edit':
case 'edit_last_post':
if ($data['topic_visibility'] != ITEM_APPROVED)
{
$phpbb_notifications->delete_notifications('topic', $data['topic_id']);
}
$phpbb_notifications->delete_notifications(array(
'quote',
'bookmark',
'post',
), $data['post_id']);
// Nothing to do here
break;
}
}