Skip to content

Commit 3d1435b

Browse files
committed
prevent mutation of imaging-request type items
1 parent 9be727e commit 3d1435b

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

client/src/itemDisplay.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import Pencil from "../icons/pencil.svg";
2424
import { ITEM_HOVER_MENU_CLASS_NAME, ItemHoverMenu } from "./itemHoverMenu";
2525
import { EditItem } from "./editItem";
2626
import { Reply } from "./reply";
27+
import { IMAGING_REQUEST_ITEM_TYPE } from "shared/octopusImaging";
2728

2829
interface ItemDisplayProps {
2930
item: Item | PendingItem;
@@ -95,6 +96,7 @@ export const ItemDisplay = ({
9596
!maybeEditingItemId &&
9697
item.userEmail === userEmail &&
9798
item.type !== "claim" &&
99+
item.type !== IMAGING_REQUEST_ITEM_TYPE &&
98100
!item.claimedByEmail;
99101

100102
return (

client/src/itemInputBox.tsx

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -318,26 +318,25 @@ export const ItemInputBox = ({
318318
payloadToBeSent?.type === IMAGING_REQUEST_ITEM_TYPE
319319
? message
320320
: message?.trim() || payloadToBeSent;
321-
if (!isAsGridPayloadLoading && hasSomethingToSend
322-
) {
323-
sendItem();
321+
if (!isAsGridPayloadLoading && hasSomethingToSend) {
322+
sendItem();
323+
}
324+
event.preventDefault();
324325
}
325-
event.preventDefault();
326-
}
327-
})
328-
}
329-
onPaste={handlePaste}
330-
onItemSelected={({ item }) => addUnverifiedMention?.(item)}
331-
rows={1}
332-
css={css`
333-
box-sizing: border-box;
334-
background-color: transparent;
335-
border: none;
336-
vertical-align: middle;
337-
&:focus-visible {
338-
outline: none;
326+
})
339327
}
340-
/* Firefox needs this hint to get the correct initial height.
328+
onPaste={handlePaste}
329+
onItemSelected={({ item }) => addUnverifiedMention?.(item)}
330+
rows={1}
331+
css={css`
332+
box-sizing: border-box;
333+
background-color: transparent;
334+
border: none;
335+
vertical-align: middle;
336+
&:focus-visible {
337+
outline: none;
338+
}
339+
/* Firefox needs this hint to get the correct initial height.
341340
Chrome will sometimes show a scrollbar at 21px, so give it a .1px extra as a nudge not to add one */
342341
height: 21.1px;
343342
${addUnverifiedMention ? "max-height: 74px;" : ""}

0 commit comments

Comments
 (0)