mirror of
https://github.com/mattermost/mattermost.git
synced 2026-09-24 16:05:00 +08:00
Custom status fixes (#17122)
* Changed the request type to POST for the remove recent custom status API Fixed the custom status clear slash command * Added Delete method in the remove recent custom status endpoint * Added one new endpoint to remove recent custom status with POST method * Added comments for the recent custom status API Co-authored-by: Manoj <manoj@brightscout.com> Co-authored-by: Chetanya Kandhari <availchet@gmail.com> Co-authored-by: Manoj <77336594+manojosh@users.noreply.github.com>
This commit is contained in:
co-authored by
Manoj
Chetanya Kandhari
Manoj
parent
bf542ec12f
commit
9eceeaa8db
@@ -15,7 +15,11 @@ func (api *API) InitStatus() {
|
||||
api.BaseRoutes.User.Handle("/status", api.ApiSessionRequired(updateUserStatus)).Methods("PUT")
|
||||
api.BaseRoutes.User.Handle("/status/custom", api.ApiSessionRequired(updateUserCustomStatus)).Methods("PUT")
|
||||
api.BaseRoutes.User.Handle("/status/custom", api.ApiSessionRequired(removeUserCustomStatus)).Methods("DELETE")
|
||||
|
||||
// Both these handlers are for removing the recent custom status but the one with the POST method should be preferred
|
||||
// as DELETE method doesn't support request body in the mobile app.
|
||||
api.BaseRoutes.User.Handle("/status/custom/recent", api.ApiSessionRequired(removeUserRecentCustomStatus)).Methods("DELETE")
|
||||
api.BaseRoutes.User.Handle("/status/custom/recent/delete", api.ApiSessionRequired(removeUserRecentCustomStatus)).Methods("POST")
|
||||
}
|
||||
|
||||
func getUserStatus(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
@@ -45,6 +45,7 @@ func (*CustomStatusProvider) DoCommand(a *app.App, args *model.CommandArgs, mess
|
||||
return nil
|
||||
}
|
||||
|
||||
message = strings.TrimSpace(message)
|
||||
if message == CmdCustomStatusClear {
|
||||
if err := a.RemoveCustomStatus(args.UserId); err != nil {
|
||||
mlog.Error(err.Error())
|
||||
|
||||
Reference in New Issue
Block a user