Add ability to use 'me' in place of user id for APIv4 (#5826)

This commit is contained in:
Joram Wilander
2017-03-21 18:43:16 -04:00
committed by GitHub
parent fd6e2f3f73
commit bea49cbcf3
4 changed files with 32 additions and 0 deletions

View File

@@ -333,6 +333,10 @@ func (c *Context) RequireUserId() *Context {
return c
}
if c.Params.UserId == model.ME {
c.Params.UserId = c.Session.UserId
}
if len(c.Params.UserId) != 26 {
c.SetInvalidUrlParam("user_id")
}