mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
added custom parentShortCid
This commit is contained in:
@@ -11,6 +11,7 @@ import Post from '../Post';
|
||||
import PostLoader from '../PostLoader';
|
||||
import ReplyModal from '../ReplyModal';
|
||||
import SettingsModal from '../SettingsModal';
|
||||
import findParentShortCid from '../../utils/findParentShortCid';
|
||||
import getCommentMediaInfo from '../../utils/getCommentMediaInfo';
|
||||
import getDate from '../../utils/getDate';
|
||||
import handleQuoteClick from '../../utils/handleQuoteClick';
|
||||
@@ -57,6 +58,8 @@ const Board = () => {
|
||||
useError(errorMessage, [errorMessage]);
|
||||
useSuccess(successMessage, [successMessage]);
|
||||
|
||||
console.log(selectedFeed);
|
||||
|
||||
|
||||
// temporary title from JSON, gets subplebbitAddress from URL
|
||||
useEffect(() => {
|
||||
@@ -518,6 +521,7 @@ const Board = () => {
|
||||
{renderedComments?.map((reply) => {
|
||||
const replyMediaInfo = getCommentMediaInfo(reply);
|
||||
const fallbackImgUrl = "/assets/filedeleted-res.gif";
|
||||
const parentShortCid = findParentShortCid(reply.parentCid, selectedFeed);
|
||||
return (
|
||||
<div key={`rc-${reply.cid}`} className="reply-container">
|
||||
<div key={`sa-${reply.cid}`} className="side-arrows">{'>>'}</div>
|
||||
@@ -632,6 +636,9 @@ const Board = () => {
|
||||
</blockquote>
|
||||
</Fragment>
|
||||
: <blockquote key={`pm-${reply.cid}`} className="post-message">
|
||||
<Link to="" key={`r-pm-${reply.cid}`} className="quotelink" onClick={() => {}}>
|
||||
{`c/${parentShortCid}`}{<br />}
|
||||
</Link>
|
||||
<Post content={reply.content} key={`post-${reply.cid}`} handlequoteclick={handleQuoteClick} comment={reply} />
|
||||
</blockquote>)
|
||||
: null}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
function findParentShortCid(parentCid, selectedFeed) {
|
||||
for (const thread of selectedFeed) {
|
||||
if (thread.cid === parentCid) {
|
||||
return thread.shortCid;
|
||||
}
|
||||
if (thread.replyCount > 0 && thread.replies.pages.topAll.comments) {
|
||||
const shortCid = findParentShortCid(parentCid, thread.replies.pages.topAll.comments);
|
||||
if (shortCid) {
|
||||
return shortCid;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
export default findParentShortCid;
|
||||
Reference in New Issue
Block a user