mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 07:35:14 +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
|
else
|
||||||
return [];
|
return [];
|
||||||
|
|
||||||
if ($i['obj']) {
|
$ret['object'] = str_replace('/item/','/activity/',$i['mid']);
|
||||||
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['to'] = [ ACTIVITY_PUBLIC_INBOX ];
|
$ret['to'] = [ ACTIVITY_PUBLIC_INBOX ];
|
||||||
return $ret;
|
return $ret;
|
||||||
|
|
||||||
|
|
|
@ -2000,11 +2000,15 @@ class Libzot {
|
||||||
continue;
|
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($arr['mid']),
|
||||||
|
dbesc(str_replace(z_root() . '/activity/', z_root() . '/item/', $arr['mid'])),
|
||||||
intval($channel['channel_id'])
|
intval($channel['channel_id'])
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($r) {
|
if ($r) {
|
||||||
// We already have this post.
|
// We already have this post.
|
||||||
$item_id = $r[0]['id'];
|
$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
|
$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 . "' ";
|
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
|
$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 ",
|
AND author_xchan = '%s' AND thr_parent = '%s' and uid = %d ",
|
||||||
dbesc($observer['xchan_hash']),
|
dbesc($observer['xchan_hash']),
|
||||||
dbesc($item['mid']),
|
dbesc($item['mid']),
|
||||||
intval($owner_uid)
|
intval($owner_uid)
|
||||||
);
|
);
|
||||||
|
|
||||||
if($r) {
|
if($r) {
|
||||||
// already liked it. Drop that item.
|
// already liked it. Drop that item.
|
||||||
foreach($r as $rr) {
|
foreach($r as $rr) {
|
||||||
|
|
Loading…
Reference in a new issue