// We only need to notfiy others when it is an original entry from us.
// Only call the notifier when the item has some content relevant change.
if ($item['origin'] && in_array('edited', array_keys($fields))) {
- Worker::add(PRIORITY_HIGH, "Notifier", 'edit_post', $item['id']);
+ Worker::add(PRIORITY_HIGH, "Notifier", Delivery::POST, $item['id']);
}
}
self::delete(['uri' => $item['uri'], 'deleted' => false], $priority);
// send the notification upstream/downstream
- Worker::add(['priority' => $priority, 'dont_fork' => true], "Notifier", "drop", intval($item['id']));
+ Worker::add(['priority' => $priority, 'dont_fork' => true], "Notifier", Delivery::DELETION, intval($item['id']));
} elseif ($item['uid'] != 0) {
// When we delete just our local user copy of an item, we have to set a marker to hide it
return 0;
}
+ if (!empty($uid) && Contact::isBlockedByUser($item['author-link'], $uid)) {
+ Logger::notice('Author is blocked by user', ['author-link' => $item['author-link'], 'uid' => $uid, 'item-uri' => $item['uri']]);
+ return 0;
+ }
+
+ if (!empty($uid) && ($item['parent-uri'] === $item['uri']) && Contact::isIgnoredByUser($item['author-link'], $uid)) {
+ Logger::notice('Author is ignored by user', ['author-link' => $item['author-link'], 'uid' => $uid, 'item-uri' => $item['uri']]);
+ return 0;
+ }
+
$default = ['url' => $item['owner-link'], 'name' => $item['owner-name'],
'photo' => $item['owner-avatar'], 'network' => $item['network']];
return 0;
}
+ if (!empty($uid) && Contact::isBlockedByUser($item['owner-link'], $uid)) {
+ Logger::notice('Owner is blocked by user', ['owner-link' => $item['owner-link'], 'uid' => $uid, 'item-uri' => $item['uri']]);
+ return 0;
+ }
+
+ if (!empty($uid) && ($item['parent-uri'] === $item['uri']) && Contact::isIgnoredByUser($item['owner-link'], $uid)) {
+ Logger::notice('Owner is ignored by user', ['owner-link' => $item['owner-link'], 'uid' => $uid, 'item-uri' => $item['uri']]);
+ return 0;
+ }
+
if ($item['network'] == Protocol::PHANTOM) {
$item['network'] = Protocol::DFRN;
Logger::notice('Missing network, setting to {network}.', [
$item['thr-parent'] = $item['parent-uri'];
- $notify_type = '';
+ $notify_type = Delivery::POST;
$allow_cid = '';
$allow_gid = '';
$deny_cid = '';
$allow_gid = $item['allow_gid'];
$deny_cid = $item['deny_cid'];
$deny_gid = $item['deny_gid'];
- $notify_type = Delivery::POST;
} else {
// find the parent and snarf the item id and ACLs
// and anything else we need to inherit
$deny_cid = $parent['deny_cid'];
$deny_gid = $parent['deny_gid'];
$item['wall'] = $parent['wall'];
- $notify_type = Delivery::COMMENT;
/*
* If the parent is private, force privacy for the entire conversation
check_user_notification($current_post);
- if ($notify) {
+ if ($notify || ($item['visible'] && ((!empty($parent) && $parent['origin']) || $item['origin']))) {
Worker::add(['priority' => $priority, 'dont_fork' => true], 'Notifier', $notify_type, $current_post);
- } elseif ($item['visible'] && ((!empty($parent) && $parent['origin']) || $item['origin'])) {
- if ($item['gravity'] == GRAVITY_ACTIVITY) {
- $cmd = $item['origin'] ? Delivery::ACTIVITY : 'activity-import';
- } elseif ($item['gravity'] == GRAVITY_COMMENT) {
- $cmd = $item['origin'] ? Delivery::COMMENT : 'comment-import';
- } elseif (!empty($notify_type)) {
- $cmd = $notify_type;
- } else {
- $cmd = Delivery::POST;
- }
-
- Worker::add(['priority' => $priority, 'dont_fork' => true], 'Notifier', $cmd, $current_post);
}
return $current_post;
self::updateThread($item_id);
- Worker::add(['priority' => PRIORITY_HIGH, 'dont_fork' => true], 'Notifier', 'tgroup', $item_id);
+ Worker::add(['priority' => PRIORITY_HIGH, 'dont_fork' => true], 'Notifier', Delivery::POST, $item_id);
}
public static function isRemoteSelf($contact, &$datarray)
$datarray['author-link'] = $datarray['owner-link'];
$datarray['author-avatar'] = $datarray['owner-avatar'];
- unset($datarray['created']);
unset($datarray['edited']);
unset($datarray['network']);