File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55
66 class SolidWebhook implements SolidNotificationsInterface
77 {
8+ public function __construct (\OCA \Solid \Service \SolidWebhookService $ webhookService ) {
9+ $ this ->webhookService = $ webhookService ;
10+ }
11+
812 public function send ($ path , $ type ) {
9- $ subscribedUrls = $ this ->getSubscribedUrls ($ path , $ type );
10- foreach ($ subscribedUrls as $ webhookUrl ) {
11- $ this ->postUpdate ($ webhookUrl , $ path , $ type );
13+ $ webhooks = $ this ->getWebhooks ($ path );
14+ foreach ($ webhooks as $ webhook ) {
15+ try {
16+ $ this ->postUpdate ($ webhook ['url ' ], $ path , $ type );
17+ } catch (\Exception $ e ) {
18+ // FIXME: add retry code here?
19+ }
1220 }
1321 }
14- private function getSubscribedUrls ($ path , $ type ) {
15- return []; // FIXME: Read this from the subscriptions
22+ private function getWebhooks ($ path , $ type ) {
23+ $ urls = $ this ->webhookService ->findByPath ($ path );
24+ return $ urls ;
1625 }
1726 private function postUpdate ($ webhookUrl , $ path , $ type ) {
1827 try {
You can’t perform that action at this time.
0 commit comments