diff --git a/.changeset/add_silent_reply_functionality.md b/.changeset/add_silent_reply_functionality.md new file mode 100644 index 00000000..9cca467c --- /dev/null +++ b/.changeset/add_silent_reply_functionality.md @@ -0,0 +1,5 @@ +--- +sable: minor +--- + +add silent replies when clicking the bell icon during composing a reply diff --git a/src/app/features/room/RoomInput.tsx b/src/app/features/room/RoomInput.tsx index dc88cabb..632a9f08 100644 --- a/src/app/features/room/RoomInput.tsx +++ b/src/app/features/room/RoomInput.tsx @@ -285,6 +285,7 @@ export const RoomInput = forwardRef( ); const [scheduleMenuAnchor, setScheduleMenuAnchor] = useState(); const [showSchedulePicker, setShowSchedulePicker] = useState(false); + const [silentReply, setSilentReply] = useState(false); const [hour24Clock] = useSetting(settingsAtom, 'hour24Clock'); const isEncrypted = room.hasEncryptionStateEvent(); @@ -344,6 +345,12 @@ export const RoomInput = forwardRef( [roomId, editor, setMsgDraft] ); + useEffect(() => { + if (replyDraft !== undefined) { + setSilentReply(replyDraft.userId === mx.getUserId()); + } + }, [mx, replyDraft]); + const handleFileMetadata = useCallback( (fileItem: TUploadItem, metadata: TUploadMetadata) => { setSelectedFiles({ @@ -517,7 +524,7 @@ export const RoomInput = forwardRef( body, }; - if (replyDraft && replyDraft.userId !== mx.getUserId()) { + if (replyDraft && !silentReply) { mentionData.users.add(replyDraft.userId); } @@ -581,6 +588,7 @@ export const RoomInput = forwardRef( mx, roomId, replyDraft, + silentReply, scheduledTime, editingScheduledDelayId, handleQuickReact, @@ -859,24 +867,56 @@ export const RoomInput = forwardRef( > - - {replyDraft.relation?.rel_type === RelationType.Thread && } - - - {getMemberDisplayName(room, replyDraft.userId, nicknames) ?? - getMxIdLocalPart(replyDraft.userId) ?? - replyDraft.userId} - + + + {replyDraft.relation?.rel_type === RelationType.Thread && ( + + )} + + + {getMemberDisplayName(room, replyDraft.userId, nicknames) ?? + getMxIdLocalPart(replyDraft.userId) ?? + replyDraft.userId} + + + } + > + + {replyBodyJSX} + + + setSilentReply(!silentReply)} > - - {replyBodyJSX} - - + {!silentReply && } + {silentReply && } +