X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fitem.php;h=72c2ed8c5d10679fef6b2ddeca31d5752f0b10cd;hb=7feeffb2458c44b9c4e0a98cdc22ac9b5e3188b9;hp=77cfc4795a755b301e622e802e1766340903da97;hpb=180b81c6e74bdc8d677f447fe796fb10783c96dd;p=friendica.git diff --git a/mod/item.php b/mod/item.php index 77cfc4795a..72c2ed8c5d 100644 --- a/mod/item.php +++ b/mod/item.php @@ -19,7 +19,7 @@ * * This is the POST destination for most all locally posted * text stuff. This function handles status, wall-to-wall status, - * local comments, and remote coments that are posted on this site + * local comments, and remote comments that are posted on this site * (as opposed to being delivered in a feed). * Also processed here are posts and comments coming through the * statusnet/twitter API. @@ -104,9 +104,9 @@ function item_edit(int $uid, array $request, bool $preview, string $return_path) } $post['edit'] = $post; - $post['file'] = Post\Category::getTextByURIId($post['uri-id'], $post['uid']); + $post['file'] = Post\Category::getTextByURIId($post['uri-id'], $post['uid']); - Post\Media::deleteByURIId($post['uri-id'], [Post\Media::AUDIO, Post\Media::VIDEO, Post\Media::IMAGE]); + Post\Media::deleteByURIId($post['uri-id'], [Post\Media::AUDIO, Post\Media::VIDEO, Post\Media::IMAGE, Post\Media::HTML]); $post = item_process($post, $request, $preview, $return_path); $fields = [ @@ -266,6 +266,7 @@ function item_process(array $post, array $request, bool $preview, string $return $post['uri-id'] = -1; $post['author-network'] = Protocol::DFRN; $post['author-updated'] = ''; + $post['author-alias'] = ''; $post['author-gsid'] = 0; $post['author-uri-id'] = ItemURI::getIdByURI($post['author-link']); $post['owner-updated'] = ''; @@ -274,7 +275,7 @@ function item_process(array $post, array $request, bool $preview, string $return $post['body'] = BBCode::removeSharedData(Item::setHashtags($post['body'])); $post['writable'] = true; - $o = DI::conversation()->create([$post], Conversation::MODE_SEARCH, false, true); + $o = DI::conversation()->render([$post], Conversation::MODE_SEARCH, false, true); System::jsonExit(['preview' => $o]); } @@ -340,7 +341,7 @@ function item_content(App $a) $args = DI::args(); - if (!$args->has(3)) { + if (!$args->has(2)) { throw new HTTPException\BadRequestException(); } @@ -384,6 +385,22 @@ function item_content(App $a) Contact\User::setIgnored($item['author-id'], DI::userSession()->getLocalUserId(), true); + if (DI::mode()->isAjax()) { + // ajax return: [, 0 (no perm) | ] + System::jsonExit([intval($args->get(2)), DI::userSession()->getLocalUserId()]); + } else { + item_redirect_after_action($item, $args->get(3)); + } + break; + + case 'collapse': + $item = Post::selectFirstForUser(DI::userSession()->getLocalUserId(), ['guid', 'author-id', 'parent', 'gravity'], ['id' => $args->get(2)]); + if (empty($item['author-id'])) { + throw new HTTPException\NotFoundException('Item not found'); + } + + Contact\User::setCollapsed($item['author-id'], DI::userSession()->getLocalUserId(), true); + if (DI::mode()->isAjax()) { // ajax return: [, 0 (no perm) | ] System::jsonExit([intval($args->get(2)), DI::userSession()->getLocalUserId()]);