diff options
Diffstat (limited to 'api4')
-rw-r--r-- | api4/status.go | 5 | ||||
-rw-r--r-- | api4/user.go | 8 |
2 files changed, 12 insertions, 1 deletions
diff --git a/api4/status.go b/api4/status.go index 59909e295..627ddaca6 100644 --- a/api4/status.go +++ b/api4/status.go @@ -71,6 +71,11 @@ func updateUserStatus(c *Context, w http.ResponseWriter, r *http.Request) { return } + currentStatus, err := c.App.GetStatus(c.Params.UserId) + if err == nil && currentStatus.Status == model.STATUS_OUT_OF_OFFICE && status.Status != model.STATUS_OUT_OF_OFFICE { + c.App.DisableAutoResponder(c.Params.UserId, c.IsSystemAdmin()) + } + switch status.Status { case "online": c.App.SetStatusOnline(c.Params.UserId, "", true) diff --git a/api4/user.go b/api4/user.go index 8f8f08c75..20b035f1d 100644 --- a/api4/user.go +++ b/api4/user.go @@ -589,8 +589,13 @@ func patchUser(c *Context, w http.ResponseWriter, r *http.Request) { return } + ouser, err := c.App.GetUser(c.Params.UserId) + if err != nil { + c.SetInvalidParam("user_id") + return + } + if c.Session.IsOAuth && patch.Email != nil { - ouser, err := c.App.GetUser(c.Params.UserId) if err != nil { c.Err = err return @@ -607,6 +612,7 @@ func patchUser(c *Context, w http.ResponseWriter, r *http.Request) { c.Err = err return } else { + c.App.SetAutoResponderStatus(ruser, ouser.NotifyProps) c.LogAudit("") w.Write([]byte(ruser.ToJson())) } |