Files
mattermost/app/terms_of_service.go
Jesús Espino a63684fcb5 Consistent license message for all the go files (#13235)
* Consistent license message for all the go files

* Fixing the last set of unconsistencies with the license headers

* Addressing PR review comments

* Fixing busy.go and busy_test.go license header
2019-11-29 12:59:40 +01:00

30 lines
776 B
Go

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package app
import (
"github.com/mattermost/mattermost-server/v5/model"
)
func (a *App) CreateTermsOfService(text, userId string) (*model.TermsOfService, *model.AppError) {
termsOfService := &model.TermsOfService{
Text: text,
UserId: userId,
}
if _, err := a.GetUser(userId); err != nil {
return nil, err
}
return a.Srv.Store.TermsOfService().Save(termsOfService)
}
func (a *App) GetLatestTermsOfService() (*model.TermsOfService, *model.AppError) {
return a.Srv.Store.TermsOfService().GetLatest(true)
}
func (a *App) GetTermsOfService(id string) (*model.TermsOfService, *model.AppError) {
return a.Srv.Store.TermsOfService().Get(id, true)
}