Merge branch 'dev' of ../p3 into dev

This commit is contained in:
nobody 2020-09-29 18:38:49 -07:00
commit 8560c10df3
3 changed files with 6 additions and 21 deletions

View file

@ -567,24 +567,7 @@ class Activity {
else
return [];
if ($i['obj']) {
if (! is_array($i['obj'])) {
$i['obj'] = json_decode($i['obj'],true);
}
$obj = self::encode_object($i['obj']);
if ($obj)
$ret['object'] = $obj;
else
return [];
}
else {
$obj = self::encode_item($i,$activitypub);
if ($obj)
$ret['object'] = $obj;
else
return [];
}
$ret['object'] = str_replace('/item/','/activity/',$i['mid']);
$ret['to'] = [ ACTIVITY_PUBLIC_INBOX ];
return $ret;

View file

@ -2000,11 +2000,15 @@ class Libzot {
continue;
}
// reactions such as like and dislike could have an mid with /activity/ in it.
// Check for both forms in order to prevent duplicates.
$r = q("select * from item where mid = '%s' and uid = %d limit 1",
$r = q("select * from item where mid in ('%s','%s') and uid = %d limit 1",
dbesc($arr['mid']),
dbesc(str_replace(z_root() . '/activity/', z_root() . '/item/', $arr['mid'])),
intval($channel['channel_id'])
);
if ($r) {
// We already have this post.
$item_id = $r[0]['id'];

View file

@ -295,14 +295,12 @@ class Like extends Controller {
$item_normal = " and item.item_deleted = 0 and item.item_unpublished = 0 and item.item_delayed = 0
and item.item_pending_remove = 0 and item.item_blocked = 0 and item.obj_type != '" . ACTIVITY_OBJ_FILE . "' ";
$r = q("SELECT id, parent, uid, verb FROM item WHERE verb in ( $verbs ) $item_normal
AND author_xchan = '%s' AND thr_parent = '%s' and uid = %d ",
dbesc($observer['xchan_hash']),
dbesc($item['mid']),
intval($owner_uid)
);
if($r) {
// already liked it. Drop that item.
foreach($r as $rr) {