$item = $items[0];
$uid = $item['uid'];
- if (!can_write_wall($a, $uid) && (($uid != 0) || !local_user())) {
+ if (($uid == 0) && local_user()) {
+ $uid = local_user();
+ }
+
+ if (!can_write_wall($a, $uid)) {
logger('like: unable to write on wall ' . $uid);
return false;
}
// Retrieves the local post owner
- if ($uid != 0) {
- $owners = q("SELECT `contact`.* FROM `contact`
- WHERE `contact`.`self`
- AND `contact`.`uid` = %d",
- intval($uid)
- );
- if (DBM::is_result($owners)) {
- $owner_self_contact = $owners[0];
- } else {
- logger('like: unknown owner ' . $uid);
- return false;
- }
+ $owners = q("SELECT `contact`.* FROM `contact`
+ WHERE `contact`.`self`
+ AND `contact`.`uid` = %d",
+ intval($uid)
+ );
+ if (DBM::is_result($owners)) {
+ $owner_self_contact = $owners[0];
} else {
- $uid = local_user();
- $owner_self_contact = ['uid' => 0, 'nick' => 'feed-item'];
+ logger('like: unknown owner ' . $uid);
+ return false;
}
// Retrieve the current logged in user's public contact
FROM `item` LEFT JOIN `sign` ON `sign`.`iid` = `item`.`id` WHERE `parent` = %d AND visible AND NOT moderated ORDER BY `id` ASC",
intval($parent_id)
);
+logger('Blubb: a-'.$item_id);
if (!count($items)) {
return;
}
+logger('Blubb: b-'.$item_id);
// avoid race condition with deleting entries
if ($items[0]['deleted']) {
$top_level = true;
}
}
+logger('Blubb: 0-'.$item_id.' - '.$uid);
$owner = User::getOwnerDataById($uid);
if (!$owner) {
return;
}
+logger('Blubb: 1-'.$item_id);
$walltowall = ($top_level && ($owner['id'] != $items[0]['contact-id']) ? true : false);
// fill this in with a single salmon slap if applicable
$slap = '';
+logger('Blubb: 2-'.$item_id);
if (! ($mail || $fsuggest || $relocate)) {
$slap = OStatus::salmon($target_item, $owner);
$parent = $items[0];
+logger('Blubb: 3-'.$item_id);
$thr_parent = q("SELECT `network`, `author-link`, `owner-link` FROM `item` WHERE `uri` = '%s' AND `uid` = %d",
dbesc($target_item["thr-parent"]), intval($target_item["uid"]));
}
}
if ($relay_to_owner) {
- logger('notifier: followup '.$target_item["guid"], LOGGER_DEBUG);
// local followup to remote post
$followup = true;
$public_message = false; // not public
$recipients = array($parent['contact-id']);
$recipients_followup = array($parent['contact-id']);
+ logger('notifier: followup '.$target_item["guid"].' to '.$conversant_str, LOGGER_DEBUG);
+
//if (!$target_item['private'] && $target_item['wall'] &&
if (!$target_item['private'] &&
(strlen($target_item['allow_cid'].$target_item['allow_gid'].