File tree Expand file tree Collapse file tree 1 file changed +19
-7
lines changed
src/packages/frontend/chat Expand file tree Collapse file tree 1 file changed +19
-7
lines changed Original file line number Diff line number Diff line change @@ -187,13 +187,20 @@ export default function Message(props: Readonly<Props>) {
187
187
const submitMentionsRef = useRef < SubmitMentionsFn > ( ) ;
188
188
189
189
const [ replying , setReplying ] = useState < boolean > ( ( ) => {
190
- return (
191
- props . actions ?. syncdb ?. get_one ( {
192
- event : "draft" ,
193
- sender_id : props . account_id ,
194
- date : - date ,
195
- } ) != null
196
- ) ;
190
+ const draft = props . actions ?. syncdb ?. get_one ( {
191
+ event : "draft" ,
192
+ sender_id : props . account_id ,
193
+ date : - date ,
194
+ } ) ;
195
+ if ( draft == null ) {
196
+ return false ;
197
+ }
198
+ if ( draft . get ( "active" ) <= 1720071100408 ) {
199
+ // before this point in time, drafts never ever got deleted when sending replies! So there's a massive
200
+ // clutter of reply drafts sitting in chats, and we don't want to resurrect them.
201
+ return false ;
202
+ }
203
+ return true ;
197
204
} ) ;
198
205
const [ autoFocusReply , setAutoFocusReply ] = useState < boolean > ( false ) ;
199
206
const [ autoFocusEdit , setAutoFocusEdit ] = useState < boolean > ( false ) ;
@@ -619,6 +626,11 @@ export default function Message(props: Readonly<Props>) {
619
626
if ( props . actions == null ) return ;
620
627
const reply = replyMentionsRef . current ?.( ) ?? replyMessageRef . current ;
621
628
props . actions . send_reply ( { message : message . toJS ( ) , reply } ) ;
629
+ props . actions . syncdb ?. delete ( {
630
+ event : "draft" ,
631
+ sender_id : props . account_id ,
632
+ date : - date ,
633
+ } ) ;
622
634
props . actions . scrollToBottom ( props . index ) ;
623
635
setReplying ( false ) ;
624
636
}
You can’t perform that action at this time.
0 commit comments