Decouple conversation creation from rendering

- This allows to separately obtain a list of threads for rendering without having to deal with an already-formed HTML output
This commit is contained in:
Hypolite Petovan 2023-02-04 19:14:21 -05:00
parent 31fbe70ec7
commit 706444bdb2
14 changed files with 294 additions and 269 deletions

View file

@ -104,7 +104,7 @@ 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::HTML]);
$post = item_process($post, $request, $preview, $return_path);
@ -274,7 +274,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]);
}

View file

@ -85,7 +85,7 @@ function notes_content(App $a, bool $update = false)
$count = count($notes);
$o .= DI::conversation()->create($notes, Conversation::MODE_NOTES, $update);
$o .= DI::conversation()->render($notes, Conversation::MODE_NOTES, $update);
}
$o .= $pager->renderMinimal($count);