Skip to content

Commit

Permalink
Merge pull request #1120 from bounswe/frontend-user-fix
Browse files Browse the repository at this point in the history
Add Condition While Reaching User Properties
  • Loading branch information
alperen-bircak authored Dec 25, 2023
2 parents 43b94b2 + 82b75de commit 748f2e5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions app/frontend/src/Components/Comment/Comment/Comment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { useQueryClient } from "react-query";
import { useState } from "react";
import ReplyForm from "../ReplyForm/ReplyForm";
import Reply from "../Reply/Reply";
import { useNavigate } from "react-router-dom";
import CommentEditForm from "../CommentForm/CommentEditForm";
import { twj } from "tw-to-css";
import { NotificationUtil } from "../../../Library/utils/notification";
Expand Down Expand Up @@ -108,7 +107,7 @@ function Comment({ comment, postId }: { comment: any; postId: string }) {
type="text"
alt="report"
/>
{(user.username === comment.commenter.username || user.isAdmin) && (
{(user?.username === comment.commenter.username || user?.isAdmin) && (
<div className={styles.delete}>
<Button
type="text"
Expand All @@ -124,7 +123,7 @@ function Comment({ comment, postId }: { comment: any; postId: string }) {
</Button>
</div>
)}
{user.id === comment.commenter.id && (
{user?.id === comment.commenter.id && (
<div className={styles.edit}>
<Button onClick={() => toggleEditing()}>
<EditOutlined />
Expand Down
2 changes: 1 addition & 1 deletion app/frontend/src/Components/Comment/Reply/Reply.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function Reply({ reply }: { reply: any }) {
<div className={styles.meta}>
<span>{reply.commenter.username}</span>
<span>{reply.createdAt && formatDate(reply.createdAt)}</span>
{user.username === reply.commenter.username && (
{user?.username === reply.commenter.username && (
<div className={styles.delete}>
<Button
type="text"
Expand Down
4 changes: 2 additions & 2 deletions app/frontend/src/Pages/ForumPost/ForumPost.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
InfoCircleOutlined,
} from "@ant-design/icons";
import clsx from "clsx";
import { Button, Tooltip, message } from "antd";
import { Button, Tooltip } from "antd";
import { useEffect, useState } from "react";
import TagRenderer from "../../Components/TagRenderer/TagRenderer.tsx";
import { twj } from "tw-to-css";
Expand Down Expand Up @@ -183,7 +183,7 @@ function ForumPost() {
if (elem && isImageAnnotationsApplied === false) {
const config = {
image: elem,
readOnly: !(user.id === post.poster.id || isAdmin),
readOnly: !(user?.id === post.poster.id || isAdmin),
};

const anno = new Annotorious(config);
Expand Down

0 comments on commit 748f2e5

Please sign in to comment.