Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

💄 Hide comment dropdown menu when unavailable to user (#564)

Jonas Höbenreich086091b67f65
diff --git a/apps/web/src/components/discussion/discussion.tsx b/apps/web/src/components/discussion/discussion.tsx
index 940cc4f3f..a151230f1 100644
--- a/apps/web/src/components/discussion/discussion.tsx
+++ b/apps/web/src/components/discussion/discussion.tsx
@@ -112,22 +112,23 @@ const Discussion: React.FunctionComponent = () => {
{dayjs(new Date(comment.createdAt)).fromNow()}
</span>
</div>
- <Dropdown
- placement="bottom-start"
- trigger={<CompactButton icon={DotsHorizontal} />}
- >
- <DropdownItem
- icon={Trash}
- label={t("deleteComment")}
- disabled={!canDelete}
- onClick={() => {
- deleteComment.mutate({
- commentId: comment.id,
- pollId,
- });
- }}
- />
- </Dropdown>
+ {canDelete &&
+ <Dropdown
+ placement="bottom-start"
+ trigger={<CompactButton icon={DotsHorizontal} />}
+ >
+ <DropdownItem
+ icon={Trash}
+ label={t("deleteComment")}
+ onClick={() => {
+ deleteComment.mutate({
+ commentId: comment.id,
+ pollId,
+ });
+ }}
+ />
+ </Dropdown>
+ }
</div>
<div className="w-fit whitespace-pre-wrap">
<TruncatedLinkify>{comment.content}</TruncatedLinkify>