From 2b3b6051d265edf131d006b2eb14f55284faf1e5 Mon Sep 17 00:00:00 2001 From: Christian Hoff Date: Thu, 1 Mar 2018 20:11:44 +0100 Subject: PLT-7567: Integration of Team Icons (#8284) * PLT-7567: Integration of Team Icons * PLT-7567: Read replica workaround, upgrade logic moved, more concrete i18n key * PLT-7567: Read replica workaround, corrections * PLT-7567: upgrade correction --- store/sqlstore/team_store.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'store/sqlstore/team_store.go') diff --git a/store/sqlstore/team_store.go b/store/sqlstore/team_store.go index cddfb7c1a..6528b8e4c 100644 --- a/store/sqlstore/team_store.go +++ b/store/sqlstore/team_store.go @@ -99,6 +99,7 @@ func (s SqlTeamStore) Update(team *model.Team) store.StoreChannel { team.CreateAt = oldTeam.CreateAt team.UpdateAt = model.GetMillis() team.Name = oldTeam.Name + team.LastTeamIconUpdate = oldTeam.LastTeamIconUpdate if count, err := s.GetMaster().Update(team); err != nil { result.Err = model.NewAppError("SqlTeamStore.Update", "store.sql_team.update.updating.app_error", nil, "id="+team.Id+", "+err.Error(), http.StatusInternalServerError) @@ -559,3 +560,13 @@ func (s SqlTeamStore) RemoveAllMembersByUser(userId string) store.StoreChannel { } }) } + +func (us SqlTeamStore) UpdateLastTeamIconUpdate(teamId string, curTime int64) store.StoreChannel { + return store.Do(func(result *store.StoreResult) { + if _, err := us.GetMaster().Exec("UPDATE Teams SET LastTeamIconUpdate = :Time, UpdateAt = :Time WHERE Id = :teamId", map[string]interface{}{"Time": curTime, "teamId": teamId}); err != nil { + result.Err = model.NewAppError("SqlTeamStore.UpdateLastTeamIconUpdate", "store.sql_team.update_last_team_icon_update.app_error", nil, "team_id="+teamId, http.StatusInternalServerError) + } else { + result.Data = teamId + } + }) +} -- cgit v1.2.3-1-g7c22