forked from grumpydevelop/federator
minor hotfix for db-saving
save activity to db *before* mutating it for the target (e.g. save before transforming article into note)
This commit is contained in:
parent
10dec5ebd3
commit
f8539e479e
1 changed files with 7 additions and 5 deletions
|
@ -351,6 +351,11 @@ class NewContent implements \Federator\Api\APIInterface
|
|||
|
||||
break;
|
||||
case 'Article':
|
||||
$articleId = $object->getID();
|
||||
\Federator\DIO\Posts::deletePost($dbh, $articleId);
|
||||
// also remove latest saved article-update
|
||||
\Federator\DIO\Posts::deletePost($dbh, $articleId . '#update');
|
||||
|
||||
// Undo Article (remove article)
|
||||
$idPart = strrchr($recipient->id, '@');
|
||||
if ($idPart === false) {
|
||||
|
@ -366,10 +371,6 @@ class NewContent implements \Federator\Api\APIInterface
|
|||
error_log("NewContent::postForUser Error in Undo Article for recipient $recipient->id, object is not an Article");
|
||||
}
|
||||
}
|
||||
$articleId = $object->getID();
|
||||
\Federator\DIO\Posts::deletePost($dbh, $articleId);
|
||||
// also remove latest saved article-update
|
||||
\Federator\DIO\Posts::deletePost($dbh, $articleId . '#update');
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -403,6 +404,8 @@ class NewContent implements \Federator\Api\APIInterface
|
|||
|
||||
break;
|
||||
case 'Article':
|
||||
\Federator\DIO\Posts::savePost($dbh, $user->id, $newActivity);
|
||||
|
||||
$idPart = strrchr($recipient->id, '@');
|
||||
if ($idPart === false) {
|
||||
error_log("NewContent::postForUser Error in Create/Update Article. $recipient->id, recipient ID is not valid");
|
||||
|
@ -417,7 +420,6 @@ class NewContent implements \Federator\Api\APIInterface
|
|||
error_log("NewContent::postForUser Error in Create/Update Article for recipient $recipient->id, object is not an Article");
|
||||
}
|
||||
}
|
||||
\Federator\DIO\Posts::savePost($dbh, $user->id, $newActivity);
|
||||
|
||||
break;
|
||||
default:
|
||||
|
|
Loading…
Add table
Reference in a new issue