First steps to support public likes

This commit is contained in:
Michael 2017-12-24 11:36:30 +00:00
parent 2e022733f6
commit fc0031f4ba

View file

@ -80,22 +80,26 @@ function do_like($item_id, $verb) {
$item = $items[0]; $item = $items[0];
if (!can_write_wall($a, $item['uid'])) { if (!can_write_wall($a, $item['uid']) && ($item['uid'] != 0)) {
logger('like: unable to write on wall ' . $item['uid']); logger('like: unable to write on wall ' . $item['uid']);
return false; return false;
} }
// Retrieves the local post owner // Retrieves the local post owner
$owners = q("SELECT `contact`.* FROM `contact` if ($item['uid'] != 0) {
WHERE `contact`.`self` $owners = q("SELECT `contact`.* FROM `contact`
AND `contact`.`uid` = %d", WHERE `contact`.`self`
intval($item['uid']) AND `contact`.`uid` = %d",
); intval($item['uid'])
if (DBM::is_result($owners)) { );
$owner_self_contact = $owners[0]; if (DBM::is_result($owners)) {
$owner_self_contact = $owners[0];
} else {
logger('like: unknown owner ' . $item['uid']);
return false;
}
} else { } else {
logger('like: unknown owner ' . $item['uid']); $owner_self_contact = ['uid' => 0, 'nick' => 'feed-item'];
return false;
} }
// Retrieve the current logged in user's public contact // Retrieve the current logged in user's public contact