Term::insertFromFileFieldByItemId($item['id']);
self::updateThread($item['id']);
- // We only need to notfiy others when it is an original entry from us
- if ($item['origin']) {
+ // 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']);
}
}
'verb', 'object-type', 'object', 'target', 'contact-id'];
$item = dba::selectFirst('item', $fields, ['id' => $item_id]);
if (!DBM::is_result($item)) {
- logger('Item with ID ' . $item_id . " hadn't been found.", LOGGER_DEBUG);
+ logger('Item with ID ' . $item_id . " hasn't been found.", LOGGER_DEBUG);
return false;
}
if ($item['deleted']) {
- logger('Item with ID ' . $item_id . ' is already deleted.', LOGGER_DEBUG);
+ logger('Item with ID ' . $item_id . ' has already been deleted.', LOGGER_DEBUG);
return false;
}
Worker::add(['priority' => $priority, 'dont_fork' => true], "Notifier", "drop", intval($item['id']));
}
- logger('Item with ID ' . $item_id . " had been deleted.", LOGGER_DEBUG);
+ logger('Item with ID ' . $item_id . " has been deleted.", LOGGER_DEBUG);
return true;
}
$item['origin'] = 1;
$item['network'] = NETWORK_DFRN;
$item['protocol'] = PROTOCOL_DFRN;
+
+ if (is_int($notify)) {
+ $priority = $notify;
+ } else {
+ $priority = PRIORITY_HIGH;
+ }
} else {
$item['network'] = trim(defaults($item, 'network', NETWORK_PHANTOM));
}
check_user_notification($current_post);
if ($notify) {
- Worker::add(['priority' => PRIORITY_HIGH, 'dont_fork' => true], "Notifier", $notify_type, $current_post);
+ Worker::add(['priority' => $priority, 'dont_fork' => true], "Notifier", $notify_type, $current_post);
} elseif (!empty($parent) && $parent['origin']) {
Worker::add(['priority' => PRIORITY_HIGH, 'dont_fork' => true], "Notifier", "comment-import", $current_post);
}