mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 05:15:16 +00:00
issue undoing like activities
This commit is contained in:
parent
ee30753ab0
commit
1079d8968d
3 changed files with 6 additions and 21 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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'];
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue