@@ -157,6 +157,7 @@ export async function openAssistantForm({
157
157
console . debug ( '[assistant] loading task' , task )
158
158
cancelTaskPolling ( )
159
159
view . showSyncTaskRunning = false
160
+ view . isNotifyEnabled = false
160
161
161
162
view . selectedTaskTypeId = task . type
162
163
view . inputs = task . input
@@ -177,6 +178,12 @@ export async function openAssistantForm({
177
178
return
178
179
}
179
180
181
+ getNotifyReady ( task . id ) . then ( response => {
182
+ view . isNotifyEnabled = ! ! response . data ?. ocs ?. data ?. id
183
+ } ) . catch ( error => {
184
+ console . error ( '[assistant] get task notification status error' , error )
185
+ } )
186
+
180
187
view . loading = true
181
188
view . showSyncTaskRunning = true
182
189
view . progress = null
@@ -277,6 +284,13 @@ export async function getTask(taskId) {
277
284
return axios . get ( url , { signal : window . assistantAbortController . signal } )
278
285
}
279
286
287
+ export async function getNotifyReady ( taskId ) {
288
+ const { default : axios } = await import ( '@nextcloud/axios' )
289
+ const { generateOcsUrl } = await import ( '@nextcloud/router' )
290
+ const url = generateOcsUrl ( '/apps/assistant/api/v1/task/{taskId}/notify' , { taskId } )
291
+ return axios . get ( url , { } )
292
+ }
293
+
280
294
export async function setNotifyReady ( taskId , enable ) {
281
295
const { default : axios } = await import ( '@nextcloud/axios' )
282
296
const { generateOcsUrl } = await import ( '@nextcloud/router' )
@@ -515,6 +529,7 @@ export async function openAssistantTask(
515
529
view . $on ( 'load-task' , ( task ) => {
516
530
cancelTaskPolling ( )
517
531
view . showSyncTaskRunning = false
532
+ view . isNotifyEnabled = false
518
533
519
534
view . selectedTaskTypeId = task . type
520
535
view . inputs = task . input
@@ -535,6 +550,12 @@ export async function openAssistantTask(
535
550
return
536
551
}
537
552
553
+ getNotifyReady ( task . id ) . then ( response => {
554
+ view . isNotifyEnabled = ! ! response . data ?. ocs ?. data ?. id
555
+ } ) . catch ( error => {
556
+ console . error ( '[assistant] get task notification status error' , error )
557
+ } )
558
+
538
559
view . loading = true
539
560
view . showSyncTaskRunning = true
540
561
view . progress = null
0 commit comments