@@ -133,6 +133,22 @@ async function _shareThread(thread: Doc<'threads'>) {
133133 toast ({ description: t (' chat.toast.threadShareLinkCopied' ) })
134134}
135135
136+ async function _freezeThread(thread : Doc <' threads' >) {
137+ const prevVal = thread .frozen
138+ thread .frozen = true
139+
140+ await freezeThread (convex , { threadId: thread ._id , lockerKey: thread .lockerKey })
141+ .catch (() => { thread .frozen = prevVal })
142+ }
143+
144+ async function _unfreezeThread(thread : Doc <' threads' >) {
145+ const prevVal = thread .frozen
146+ thread .frozen = undefined
147+
148+ await unfreezeThread (convex , { threadId: thread ._id , lockerKey: thread .lockerKey })
149+ .catch (() => { thread .frozen = prevVal })
150+ }
151+
136152const [DefineDeleteBtn, ReuseDeleteBtn] = createReusableTemplate <{ thread: Doc <' threads' > }>()
137153const [DefineThreadLiItem, ReuseThreadLiItem] = createReusableTemplate <{ thread: Doc <' threads' >, pinned? : boolean }>()
138154 </script >
@@ -279,8 +295,8 @@ const [DefineThreadLiItem, ReuseThreadLiItem] = createReusableTemplate<{ thread:
279295 </ContextMenuItem >
280296 <ContextMenuItem
281297 @click =" thread.frozen
282- ? unfreezeThread(convex, { threadId: thread._id, lockerKey: thread.lockerKey } )
283- : freezeThread(convex, { threadId: thread._id, lockerKey: thread.lockerKey } )"
298+ ? _unfreezeThread( thread)
299+ : _freezeThread( thread)"
284300 >
285301 {{ thread.frozen ? $t('chat.thread.unfreeze') : $t('chat.thread.freeze') }}
286302 </ContextMenuItem >
0 commit comments