diff options
Diffstat (limited to 'app/team.go')
-rw-r--r-- | app/team.go | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/app/team.go b/app/team.go index 78d932870..f5235792f 100644 --- a/app/team.go +++ b/app/team.go @@ -103,6 +103,7 @@ func (a *App) UpdateTeam(team *model.Team) (*model.Team, *model.AppError) { oldTeam.AllowOpenInvite = team.AllowOpenInvite oldTeam.CompanyName = team.CompanyName oldTeam.AllowedDomains = team.AllowedDomains + oldTeam.LastTeamIconUpdate = team.LastTeamIconUpdate if result := <-a.Srv.Store.Team().Update(oldTeam); result.Err != nil { return nil, result.Err @@ -1007,7 +1008,7 @@ func (a *App) SetTeamIconFromFile(teamId string, file multipart.File) *model.App curTime := model.GetMillis() if result := <-a.Srv.Store.Team().UpdateLastTeamIconUpdate(teamId, curTime); result.Err != nil { - return model.NewAppError("SetTeamIcon", "api.team.set_team_icon.update.app_error", nil, result.Err.Error(), http.StatusBadRequest) + return model.NewAppError("SetTeamIcon", "api.team.team_icon.update.app_error", nil, result.Err.Error(), http.StatusBadRequest) } // manually set time to avoid possible cluster inconsistencies @@ -1017,3 +1018,20 @@ func (a *App) SetTeamIconFromFile(teamId string, file multipart.File) *model.App return nil } + +func (a *App) RemoveTeamIcon(teamId string) *model.AppError { + team, err := a.GetTeam(teamId) + if err != nil { + return model.NewAppError("RemoveTeamIcon", "api.team.remove_team_icon.get_team.app_error", nil, err.Error(), http.StatusBadRequest) + } + + if result := <-a.Srv.Store.Team().UpdateLastTeamIconUpdate(teamId, 0); result.Err != nil { + return model.NewAppError("RemoveTeamIcon", "api.team.team_icon.update.app_error", nil, result.Err.Error(), http.StatusBadRequest) + } + + team.LastTeamIconUpdate = 0 + + a.sendTeamEvent(team, model.WEBSOCKET_EVENT_UPDATE_TEAM) + + return nil +} |