From 56f23fad45bab476efe6a74f207dfe78470f1b87 Mon Sep 17 00:00:00 2001 From: Renard Date: Wed, 25 Sep 2019 23:33:29 -0300 Subject: Registro de posts propios 🔥 --- src/Post.js | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'src/Post.js') diff --git a/src/Post.js b/src/Post.js index 8193ec1..54e56e7 100644 --- a/src/Post.js +++ b/src/Post.js @@ -155,6 +155,30 @@ const Post = ({ index, post, locked, threadId, currentBoard, nightMode }) => { ); const youtubeVideos = post.message.match(youtubeRe); + // El post es nuestro? + const ownPosts = JSON.parse(localStorage.getItem("ownPosts")); + let isMine = false; + if (ownPosts !== null) { + if (Object.prototype.hasOwnProperty.call(ownPosts, currentBoard.dir)) { + ownPosts[currentBoard.dir].forEach(reply => { + if (reply.thread_id === post.parentid) { + if (reply.reply_id === post.id) { + isMine = true; + } + } + }); + } + } + + let starColor; + if (user_id === "CAP_USER*") { + starColor = "yellow"; + } else if (isMine) { + starColor = "blue"; + } else { + starColor = "gray"; + } + return ( {
- + {user_id === "CAP_USER*" ? ( "Usuario verificado" ) : ( {user_id} )} + {isMine ? " (Tú)" : null}
-- cgit v1.2.1-18-gbd029