Fix bugs in the retraction code
Currently, the following seems to be the functional status: For a Diaspora top-level post: Friendica comments show up AND delete Diaspora comments show up AND delete for top-level owner Diaspora comments show up for non-owner Diaspora comments sometimes don't delete for non-owner -> Appears to be Diaspora's fault, as a "not a valid object" error shows up in the log Friendica likes show up, but can't unlike (Friendica doesn't even message Diaspora) Diaspora likes show up Diaspora non-owner can't unlike -> Same as comments, seems to be Diaspora's fault For a Friendica top-level post: Friendica comments show up AND delete Diaspora comments show up AND delete Friendica likes don't show up in Diaspora sometimes Friendica doesn't even message Diaspora for unlikes (sometimes?) Diaspora likes and unlikes work
This commit is contained in:
parent
b000088ded
commit
77962aa79d
7 changed files with 42 additions and 66 deletions
|
|
@ -3281,33 +3281,33 @@ function drop_item($id,$interactive = true) {
|
|||
}
|
||||
|
||||
// Add a relayable_retraction signature for Diaspora. Note that we can't add a target_author_signature
|
||||
// if the comment was deleted by a remote user. That should be ok, because if a remote user is deleting
|
||||
// the comment, that means we're the home of the post, and Diaspora will only
|
||||
// if the comment/like was deleted by a remote user. That should be ok, because if a remote user is deleting
|
||||
// the comment/like, that means we're the home of the post, and Diaspora will only
|
||||
// check the parent_author_signature of retractions that it doesn't have to relay further
|
||||
if( strcmp($item['type'], 'activity') != 0) {
|
||||
$signed_text = $item['guid'] . ';' . 'Comment';
|
||||
$signed_text = $item['guid'] . ';' . ( ($item['verb'] === ACTIVITY_LIKE) ? 'Like' : 'Comment');
|
||||
|
||||
if(local_user() == $item['uid']) {
|
||||
if(local_user() == $item['uid']) {
|
||||
|
||||
$handle = $a->user['nickname'] . '@' . substr($a->get_baseurl(), strpos($a->get_baseurl(),'://') + 3);
|
||||
$authorsig = base64_encode(rsa_sign($signed_text,$a->user['prvkey'],'sha256'));
|
||||
}
|
||||
else {
|
||||
$r = q("SELECT `nick`, `url` FROM `contact` WHERE `id` = '%d' LIMIT 1",
|
||||
$item['contact-id']
|
||||
);
|
||||
if(count($r))
|
||||
$handle = $r['nick'] . '@' . substr($r['url'], strpos($r['url'],'://') + 3, strpos($r['url'],'/profile') - 1);
|
||||
}
|
||||
|
||||
if(isset($handle)
|
||||
q("insert into sign (`retract_iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ",
|
||||
intval($item['id']),
|
||||
dbesc($signed_text),
|
||||
dbesc($authorsig),
|
||||
dbesc($handle)
|
||||
);
|
||||
$handle = $a->user['nickname'] . '@' . substr($a->get_baseurl(), strpos($a->get_baseurl(),'://') + 3);
|
||||
$authorsig = base64_encode(rsa_sign($signed_text,$a->user['prvkey'],'sha256'));
|
||||
}
|
||||
else {
|
||||
$r = q("SELECT `nick`, `url` FROM `contact` WHERE `id` = '%d' LIMIT 1",
|
||||
$item['contact-id']
|
||||
);
|
||||
if(count($r)) {
|
||||
$handle = $r['nick'] . '@' . substr($r['url'], strpos($r['url'],'://') + 3, strpos($r['url'],'/profile') - 1);
|
||||
$authorsig = '';
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($handle))
|
||||
q("insert into sign (`retract_iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ",
|
||||
intval($item['id']),
|
||||
dbesc($signed_text),
|
||||
dbesc($authorsig),
|
||||
dbesc($handle)
|
||||
);
|
||||
}
|
||||
$drop_id = intval($item['id']);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue