aboutsummaryrefslogtreecommitdiff
path: root/src/Post.js
diff options
context:
space:
mode:
authorLibravatar Renard 2019-09-25 23:33:29 -0300
committerLibravatar Renard 2019-09-25 23:33:29 -0300
commit56f23fad45bab476efe6a74f207dfe78470f1b87 (patch)
tree8527e90576bdd863e0ba48df460ca03f2cbc86c6 /src/Post.js
parent52f3fa7fea2915d9db7d9e97f926ad544ac328c4 (diff)
downloadbai-client-56f23fad45bab476efe6a74f207dfe78470f1b87.tar.gz
bai-client-56f23fad45bab476efe6a74f207dfe78470f1b87.tar.xz
bai-client-56f23fad45bab476efe6a74f207dfe78470f1b87.zip
Registro de posts propios 🔥
Diffstat (limited to 'src/Post.js')
-rw-r--r--src/Post.js30
1 files changed, 26 insertions, 4 deletions
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 (
<Comment inverted={nightMode}>
<Comment.Avatar
@@ -182,15 +206,13 @@ const Post = ({ index, post, locked, threadId, currentBoard, nightMode }) => {
<Moment fromNow unix locale="es" date={post.timestamp} />
</div>
<div>
- <Icon
- name="star"
- color={user_id === "CAP_USER*" ? "yellow" : "grey"}
- />
+ <Icon name="star" color={starColor} />
{user_id === "CAP_USER*" ? (
"Usuario verificado"
) : (
<span style={{ color: idColor }}>{user_id}</span>
)}
+ {isMine ? " (Tú)" : null}
</div>
</Comment.Metadata>
<Comment.Text>