WIP Out Of Office

Return error for status command if user status is OOO

Ignore notifications if Out Of Office

Disable AutoResponder if status is set to online

Add test for AutoResponder

DisableAutoResponse when manually setting status

Remove check on status slash command

return early if user does not exists in SendAutoResponse method

Add proper error handling

Add a newline after error handling

Revert back to err == nil in api4/status.go

Remove a.Go when using a.Publish

Add name consistency with the feature auto responder

Last changes for name consistency, also fix failing test with auto_responder

Fix names of functions in auto responder test

Add ExperimentalEnableAutomaticReplies flag

Auto Responder reply to a post
Этот коммит содержится в:
Stan Chan
2018-04-12 12:02:36 -07:00
коммит произвёл Joram Wilander
родитель 8df6d5cc30
Коммит 7826774a14
11 изменённых файлов: 293 добавлений и 4 удалений

Просмотреть файл

@@ -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)

Просмотреть файл

@@ -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()))
}