Issue 6521: Don't send notifications for deleted items
This commit is contained in:
parent
5f2028b657
commit
461c3169b1
1 changed files with 5 additions and 5 deletions
|
@ -142,7 +142,7 @@ function notification($params)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($params['type'] == NOTIFY_COMMENT || $params['type'] == NOTIFY_TAGSELF) {
|
if ($params['type'] == NOTIFY_COMMENT || $params['type'] == NOTIFY_TAGSELF) {
|
||||||
$thread = Item::selectFirstThreadForUser($params['uid'], ['ignored'], ['iid' => $parent_id]);
|
$thread = Item::selectFirstThreadForUser($params['uid'], ['ignored'], ['iid' => $parent_id, 'deleted' => false]);
|
||||||
if (DBA::isResult($thread) && $thread['ignored']) {
|
if (DBA::isResult($thread) && $thread['ignored']) {
|
||||||
Logger::log('Thread ' . $parent_id . ' will be ignored', Logger::DEBUG);
|
Logger::log('Thread ' . $parent_id . ' will be ignored', Logger::DEBUG);
|
||||||
L10n::popLang();
|
L10n::popLang();
|
||||||
|
@ -161,7 +161,7 @@ function notification($params)
|
||||||
// if it's a post figure out who's post it is.
|
// if it's a post figure out who's post it is.
|
||||||
$item = null;
|
$item = null;
|
||||||
if ($params['otype'] === 'item' && $parent_id) {
|
if ($params['otype'] === 'item' && $parent_id) {
|
||||||
$item = Item::selectFirstForUser($params['uid'], Item::ITEM_FIELDLIST, ['id' => $parent_id]);
|
$item = Item::selectFirstForUser($params['uid'], Item::ITEM_FIELDLIST, ['id' => $parent_id, 'deleted' => false]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$item_post_type = Item::postType($item);
|
$item_post_type = Item::postType($item);
|
||||||
|
@ -783,7 +783,7 @@ function check_item_notification($itemid, $uid, $defaulttype = "") {
|
||||||
$fields = ['id', 'mention', 'tag', 'parent', 'title', 'body',
|
$fields = ['id', 'mention', 'tag', 'parent', 'title', 'body',
|
||||||
'author-link', 'author-name', 'author-avatar', 'author-id',
|
'author-link', 'author-name', 'author-avatar', 'author-id',
|
||||||
'guid', 'parent-uri', 'uri', 'contact-id', 'network'];
|
'guid', 'parent-uri', 'uri', 'contact-id', 'network'];
|
||||||
$condition = ['id' => $itemid, 'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT]];
|
$condition = ['id' => $itemid, 'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT], 'deleted' => false];
|
||||||
$item = Item::selectFirstForUser($uid, $fields, $condition);
|
$item = Item::selectFirstForUser($uid, $fields, $condition);
|
||||||
if (!DBA::isResult($item) || in_array($item['author-id'], $contacts)) {
|
if (!DBA::isResult($item) || in_array($item['author-id'], $contacts)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -840,7 +840,7 @@ function check_item_notification($itemid, $uid, $defaulttype = "") {
|
||||||
|
|
||||||
// Is it a post that the user had started?
|
// Is it a post that the user had started?
|
||||||
$fields = ['ignored', 'mention'];
|
$fields = ['ignored', 'mention'];
|
||||||
$thread = Item::selectFirstThreadForUser($params['uid'], $fields, ['iid' => $item["parent"]]);
|
$thread = Item::selectFirstThreadForUser($params['uid'], $fields, ['iid' => $item["parent"], 'deleted' => false]);
|
||||||
|
|
||||||
if ($thread['mention'] && !$thread['ignored'] && !isset($params["type"])) {
|
if ($thread['mention'] && !$thread['ignored'] && !isset($params["type"])) {
|
||||||
$params["type"] = NOTIFY_COMMENT;
|
$params["type"] = NOTIFY_COMMENT;
|
||||||
|
@ -848,7 +848,7 @@ function check_item_notification($itemid, $uid, $defaulttype = "") {
|
||||||
}
|
}
|
||||||
|
|
||||||
// And now we check for participation of one of our contacts in the thread
|
// And now we check for participation of one of our contacts in the thread
|
||||||
$condition = ['parent' => $item["parent"], 'author-id' => $contacts];
|
$condition = ['parent' => $item["parent"], 'author-id' => $contacts, 'deleted' => false];
|
||||||
|
|
||||||
if (!$thread['ignored'] && !isset($params["type"]) && Item::exists($condition)) {
|
if (!$thread['ignored'] && !isset($params["type"]) && Item::exists($condition)) {
|
||||||
$params["type"] = NOTIFY_COMMENT;
|
$params["type"] = NOTIFY_COMMENT;
|
||||||
|
|
Loading…
Reference in a new issue