1
0
Fork 0

Store personal copy of public item upon commenting

This commit is contained in:
Michael 2020-07-21 23:26:01 +00:00
commit d0ef6f2b08
2 changed files with 11 additions and 1 deletions

View file

@ -136,6 +136,16 @@ function item_post(App $a) {
throw new HTTPException\NotFoundException(DI::l10n()->t('Unable to locate original post.'));
}
// When commenting on a public post then store the post for the current user
// This enables interaction like starring and saving into folders
if ($toplevel_item['uid'] == 0) {
$stored = Item::storeForUser($toplevel_item, local_user());
Logger::info('Public item stored for user', ['uri-id' => $toplevel_item['uri-id'], 'uid' => $uid, 'stored' => $stored]);
if ($stored) {
$toplevel_item = Item::selectFirst([], ['id' => $stored]);
}
}
$toplevel_item_id = $toplevel_item['id'];
$parent_user = $toplevel_item['uid'];