@@ -338,6 +338,81 @@ public function prepare(INotification $notification, string $languageCode): INot
338338
339339 return $ notification ;
340340
341+ case 'assignment_approval_pending ' :
342+ $ subject = $ l ->t ('Assignment run pending review ' );
343+
344+ $ iconUrl = $ this ->url ->getAbsoluteURL ($ this ->url ->imagePath (Application::APP_ID , 'app-dark.svg ' ));
345+
346+ $ message = $ l ->t ('"%s" awaits your review before continuing. ' , [$ params ['sessionTitle ' ]]);
347+
348+ $ notification
349+ ->setParsedSubject ($ subject )
350+ ->setParsedMessage ($ message )
351+ // TODO: link directly to assignment
352+ ->setLink ($ this ->url ->linkToRouteAbsolute (Application::APP_ID . '.assistant.getAssistantStandalonePage ' , ['sessionId ' => $ params ['sessionId ' ]]))
353+ ->setIcon ($ iconUrl );
354+
355+ $ actionLabel = $ l ->t ('View assignment ' );
356+ $ action = $ notification ->createAction ();
357+ $ action ->setLabel ($ actionLabel )
358+ ->setParsedLabel ($ actionLabel )
359+ ->setLink ($ notification ->getLink (), IAction::TYPE_WEB )
360+ ->setPrimary (true );
361+
362+ $ notification ->addParsedAction ($ action );
363+
364+ return $ notification ;
365+
366+ case 'assignment_successful ' :
367+ $ subject = $ l ->t ('Assignment succeeded ' );
368+
369+ $ iconUrl = $ this ->url ->getAbsoluteURL ($ this ->url ->imagePath (Application::APP_ID , 'app-dark.svg ' ));
370+
371+ $ message = $ l ->t ('"%s" was run successfully. ' , [$ params ['sessionTitle ' ]]);
372+
373+ $ notification
374+ ->setParsedSubject ($ subject )
375+ ->setParsedMessage ($ message )
376+ // TODO: link directly to assignment
377+ ->setLink ($ this ->url ->linkToRouteAbsolute (Application::APP_ID . '.assistant.getAssistantStandalonePage ' , ['sessionId ' => $ params ['sessionId ' ]]))
378+ ->setIcon ($ iconUrl );
379+
380+ $ actionLabel = $ l ->t ('View assignment result ' );
381+ $ action = $ notification ->createAction ();
382+ $ action ->setLabel ($ actionLabel )
383+ ->setParsedLabel ($ actionLabel )
384+ ->setLink ($ notification ->getLink (), IAction::TYPE_WEB )
385+ ->setPrimary (true );
386+
387+ $ notification ->addParsedAction ($ action );
388+
389+ return $ notification ;
390+
391+ case 'assignment_failure ' :
392+ $ subject = $ l ->t ('Assignment failed ' );
393+
394+ $ iconUrl = $ this ->url ->getAbsoluteURL ($ this ->url ->imagePath (Application::APP_ID , 'app-dark.svg ' ));
395+
396+ $ message = $ l ->t ('"%s" failed to run. ' , [$ params ['sessionTitle ' ]]);
397+
398+ $ notification
399+ ->setParsedSubject ($ subject )
400+ ->setParsedMessage ($ message )
401+ // TODO: link directly to assignment
402+ ->setLink ($ this ->url ->linkToRouteAbsolute (Application::APP_ID . '.assistant.getAssistantStandalonePage ' , ['sessionId ' => $ params ['sessionId ' ]]))
403+ ->setIcon ($ iconUrl );
404+
405+ $ actionLabel = $ l ->t ('View assignment result ' );
406+ $ action = $ notification ->createAction ();
407+ $ action ->setLabel ($ actionLabel )
408+ ->setParsedLabel ($ actionLabel )
409+ ->setLink ($ notification ->getLink (), IAction::TYPE_WEB )
410+ ->setPrimary (true );
411+
412+ $ notification ->addParsedAction ($ action );
413+
414+ return $ notification ;
415+
341416 default :
342417 // Unknown subject => Unknown notification => throw
343418 throw new InvalidArgumentException ();
0 commit comments