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,12 +80,13 @@ 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
if ($item['uid'] != 0) {
$owners = q("SELECT `contact`.* FROM `contact` $owners = q("SELECT `contact`.* FROM `contact`
WHERE `contact`.`self` WHERE `contact`.`self`
AND `contact`.`uid` = %d", AND `contact`.`uid` = %d",
@ -97,6 +98,9 @@ function do_like($item_id, $verb) {
logger('like: unknown owner ' . $item['uid']); logger('like: unknown owner ' . $item['uid']);
return false; return false;
} }
} else {
$owner_self_contact = ['uid' => 0, 'nick' => 'feed-item'];
}
// Retrieve the current logged in user's public contact // Retrieve the current logged in user's public contact
$author_id = public_contact(); $author_id = public_contact();