diff --git a/components/discussion/discussion.tsx b/components/discussion/discussion.tsx index c0b1ceb3f..eebdab186 100644 --- a/components/discussion/discussion.tsx +++ b/components/discussion/discussion.tsx @@ -13,7 +13,6 @@ import { CreateCommentPayload, } from "../../api-client/create-comment"; import { requiredString } from "../../utils/form-validation"; -import Badge from "../badge"; import Button from "../button"; import CompactButton from "../compact-button"; import Dropdown, { DropdownItem } from "../dropdown"; @@ -24,7 +23,7 @@ import TruncatedLinkify from "../poll/truncated-linkify"; import UserAvatar from "../poll/user-avatar"; import { usePoll } from "../poll-context"; import { usePreferences } from "../preferences/use-preferences"; -import { useSession } from "../session"; +import { isUnclaimed, useSession } from "../session"; export interface DiscussionProps { pollId: string; @@ -125,7 +124,9 @@ const Discussion: React.VoidFunctionComponent = ({ {comments.map((comment) => { const canDelete = - poll.role === "admin" || session.ownsObject(comment); + poll.role === "admin" || + session.ownsObject(comment) || + isUnclaimed(comment); return ( = ({ pollId }) => { ? participantById[selectedParticipantId] : undefined; - const [editable, setEditable] = React.useState(false); + const [isEditing, setIsEditing] = React.useState(false); const [shouldShowSaveButton, setShouldShowSaveButton] = React.useState(false); const formRef = React.useRef(null); @@ -129,7 +128,7 @@ const MobilePoll: React.VoidFunctionComponent = ({ pollId }) => { { onSuccess: () => { resolve(data); - setEditable(false); + setIsEditing(false); }, onError: reject, }, @@ -139,7 +138,7 @@ const MobilePoll: React.VoidFunctionComponent = ({ pollId }) => { onSuccess: (newParticipant) => { setSelectedParticipantId(newParticipant.id); resolve(data); - setEditable(false); + setIsEditing(false); }, onError: reject, }); @@ -152,13 +151,13 @@ const MobilePoll: React.VoidFunctionComponent = ({ pollId }) => {
@@ -206,14 +205,16 @@ const MobilePoll: React.VoidFunctionComponent = ({ pollId }) => {
- {!poll.closed && !editable ? ( + {!poll.closed && !isEditing ? ( selectedParticipant && - (role === "admin" || session.ownsObject(selectedParticipant)) ? ( + (role === "admin" || + session.ownsObject(selectedParticipant) || + isUnclaimed(selectedParticipant)) ? (
) ) : null} - {editable ? ( + {isEditing ? (