use Friendica\App;
use Friendica\Content\Item as ItemHelper;
+use Friendica\Content\PageInfo;
use Friendica\Content\Text\BBCode;
use Friendica\Core\Hook;
use Friendica\Core\Logger;
use Friendica\Util\Strings;
use Friendica\Worker\Delivery;
-require_once __DIR__ . '/../include/items.php';
-
function item_post(App $a) {
if (!Session::isAuthenticated()) {
throw new HTTPException\ForbiddenException();
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::storeForUserByUriId($toplevel_item['uri-id'], 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'];
];
}
- $att_bbcode = add_page_info_data($attachment);
+ $att_bbcode = "\n" . PageInfo::getFooterFromData($attachment);
$body .= $att_bbcode;
}
System::jsonExit(['preview' => '']);
}
- info(DI::l10n()->t('Empty post discarded.'));
+ notice(DI::l10n()->t('Empty post discarded.'));
if ($return_path) {
DI::baseUrl()->redirect($return_path);
}
// update filetags in pconfig
FileTag::updatePconfig($uid, $categories_old, $categories_new, 'category');
- info(DI::l10n()->t('Post updated.'));
if ($return_path) {
DI::baseUrl()->redirect($return_path);
}
$post_id = Item::insert($datarray);
if (!$post_id) {
- info(DI::l10n()->t('Item wasn\'t stored.'));
+ notice(DI::l10n()->t('Item wasn\'t stored.'));
if ($return_path) {
DI::baseUrl()->redirect($return_path);
}
return $post_id;
}
- info(DI::l10n()->t('Post published.'));
item_post_return(DI::baseUrl(), $api_source, $return_path);
// NOTREACHED
}
$item = Item::selectFirstForUser(local_user(), $fields, ['id' => $id]);
if (!DBA::isResult($item)) {
- notice(DI::l10n()->t('Item not found.') . EOL);
+ notice(DI::l10n()->t('Item not found.'));
DI::baseUrl()->redirect('network');
}