diff options
Diffstat (limited to 'lib/apiv1/events.go')
-rw-r--r-- | lib/apiv1/events.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/apiv1/events.go b/lib/apiv1/events.go index da8298c..9444262 100644 --- a/lib/apiv1/events.go +++ b/lib/apiv1/events.go @@ -112,6 +112,9 @@ func (s *APIService) eventsRegister(c *gin.Context) { Folder: *cfg, } + s.log.Debugf("WS Emit %s - Status=%10s, IsInSync=%6v, ID=%s", + EventEventType+evType, cfg.Status, cfg.IsInSync, cfg.ID) + if err := (*so).Emit(EventEventType+evType, msg); err != nil { s.log.Errorf("WS Emit Folder StateChanged event : %v", err) } @@ -119,11 +122,15 @@ func (s *APIService) eventsRegister(c *gin.Context) { data := make(folder.EventCBData) data["sid"] = sess.ID - err := s.mfolders.RegisterEventChange(args.ProjectID, &cbFunc, &data) + prjID, err := s.mfolders.ResolveID(args.ProjectID) if err != nil { common.APIError(c, err.Error()) return } + if err = s.mfolders.RegisterEventChange(prjID, &cbFunc, &data); err != nil { + common.APIError(c, err.Error()) + return + } c.JSON(http.StatusOK, gin.H{"status": "OK"}) } |